Behaviour of firebase.auth().currentUser
Behaviour of firebase.auth().currentUser
In my app, I use firebase for user management. Now there is an admin account and I wish to create a new account from inside the admin account. In the database, the admin account is just another user account with a key value pair category:"admin" in it. Now, I use the following code in my app to create a new user and this code runs with admin logged in :
try{
await firebase.auth().createUserWithEmailAndPassword(email,password)
console.log(firebase.auth().currentUser)
}
catch(error) {
await this.setState({message:error.message})
}
What would this log? The admin user or the newly created user? If it logs the admin user, is there a function to get the new user or will I have to loop through the users finding the email?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Comments
Post a Comment