Home > database >  Login a user with their firebase user id react native
Login a user with their firebase user id react native

Time:01-17

so I wanted to keep a user logged in after they reload the app. I did that by using Async Storage, What I did was if a user's id is present in the Async Storage, I would consider them logged in. The drawback was I couldn't use the Firebase auth because it wont consider the user logged in. I know that it's a bad idea to store passwords in Async Storage so i stored the uid. Is there any way I could log in they user with just their uid so if i use firebase.currentUser it won't show null.

I am using firebase v9 and react native

CodePudding user response:

I think you are using the web version of firebase. You have to consider using the react-native-firebase library which handles this behavior automatically for free.

And the answer to your question. No, you can't log the user in using his uid.

  •  Tags:  
  • Related