Manage Users in Firebase
Notice
This page is archived and might not reflect the latest version of the FlutterFire plugins. You can find the latest information on firebase.google.com:
#
Create a userYou create a new user in your Firebase project in four ways:
- Call the
createUserWithEmailAndPassword()
method. - Sign in a user for the first time using a federated identity provider, such as Google Sign-In, Facebook Login, or Apple.
You can also create new password-authenticated users from the Authentication section of the Firebase console, on the Users page.
#
Get a user's profileTo get a user's profile information, use the properties of User
. For example:
#
Get a user's provider-specific profile informationTo get the profile information retrieved from the sign-in providers linked to a
user, use the providerData
property. For example:
#
Update a user's profileYou can update a user's basic profile information—the user's display name
and profile photo URL—with the update
- methods. For example:
#
Set a user's email addressYou can set a user's email address with the updateEmail()
method. For example:
important
To set a user's email address, the user must have signed in recently. See Re-authenticate a user.
#
Send a user a verification emailYou can send an address verification email to a user with the
sendEmailVerification()
method. For example:
You can customize the email template that is used in Authentication section of the Firebase console, on the Email Templates page. See Email Templates in Firebase Help Center.
It is also possible to pass state via a continue URL to redirect back to the app when sending a verification email.
Additionally you can localize the verification email by updating the language code on the Auth instance before sending the email. For example:
#
Set a user's passwordYou can set a user's password with the updatePassword()
method. For example:
important
To set a user's email address, the user must have signed in recently. See Re-authenticate a user.
#
Send a password reset emailYou can send a password reset email to a user with the sendPasswordResetEmail()
method. For example:
You can customize the email template that is used in Authentication section of the Firebase console, on the Email Templates page. See Email Templates in Firebase Help Center.
It is also possible to pass state via a continue URL to redirect back to the app when sending a password reset email.
Additionally you can localize the password reset email by updating the language code on the Auth instance before sending the email. For example:
You can also send password reset emails from the Firebase console.
#
Delete a userYou can delete a user account with the delete()
method. For example:
important
To set a user's email address, the user must have signed in recently. See Re-authenticate a user.
You can also delete users from the Authentication section of the Firebase console, on the Users page.
#
Re-authenticate a userSome security-sensitive actions—such as
deleting an account,
setting a primary email address, and
changing a password—require that the user has
recently signed in. If you perform one of these actions, and the user signed in
too long ago, the action fails and throws a FirebaseAuthException
with the code
requires-recent-login
.
When this happens, re-authenticate the user by getting new sign-in credentials
from the user and passing the credentials to reauthenticate
. For example:
#
Import user accountsYou can import user accounts from a file into your Firebase project by using the
Firebase CLI's auth:import
command. For example: