3

I want to add a new data to firebase authentication which has data like displayname, phone number, image. But i want to add more such gender, birthday and more. is it possible to add new?

2 Answers 2

14

There is no way to add arbitrary additional data to Firebase Authentication user profiles. If you want that, consider using the Firebase Realtime Database (or Cloud Firestore) for storing the additional information.

This approach has been covered in quite a few questions in the past, so I'll link you to those:

Since a few weeks ago you can add small bits of information to the Firebase Authentication user profile. While this might sound like what you need, it is explicitly not meant for storing user metadata such as you need. Instead this is intended for storing so-called claims: properties about the user that you then access in the security rules. See the documentation for setting custom claims.

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you so much sir. I think i would use Firebase Realtime Database instead of Firebase Authentication
Could you help me how to link between Firebase Realtime Database and Firebase Authentication? I mean i would use Realtime Database for saving additional user infomation then Authentication just used for Log In Authentication.
Did you read the links I shared? Multiple of them show precisely how to do this in various languages. If you're having a hard time making it work, share the code of where you got stuck (read the link, it's quite useful).
This is one of the responses I want to press more than one time on the UP button :) Thx a lot for the detailed response !
1

I had the same problem when introducing user roles for authorization in my React with Firebase application. Somehow I wanted to be able to pass a roles property to the authenticated user, but found myself again in Firebase's restrictive framework of doing it their way.

I found a way around it by (1) managing users myself in the Firebase database and (2) merging the authenticated user with the database user when the application loads. Then I am able to add additional user properties (e.g. roles) to my database user, because it will be merged with the authenticated user anyway.

If you are interested in this approach, checkout this tutorial.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.