Firebase.Auth.FirebaseUser

Firebase user account object.

Summary

This class allows you to manipulate the profile of a user, link to and unlink from authentication providers, and refresh authentication tokens.

Inheritance

Inherits from: Firebase.Auth.IUserInfo, SystemIDisposable

Properties

DisplayName
string
Gets the display name associated with the user, if any.
Email
string
Gets email associated with the user, if any.
IsAnonymous
bool
True if user signed in anonymously.
IsEmailVerified
bool
True if the email address associated with this user has been verified.
PhotoUrl
System.Uri
The photo url associated with the user, if any.
ProviderData
global::System.Collections.Generic.IEnumerable< IUserInfo >
Gets the third party profile data associated with this user returned by the authentication server, if any.
ProviderId
string
Gets the provider ID for the user (For example, "Facebook").
RefreshToken
string
Gets the raw refresh token (only for use in advanced scenarios where manually refresh of tokens is required).
UserId
string
Gets the unique Firebase user ID for the user.

Public functions

DeleteAsync()
Deletes the user account.
Dispose()
void
LinkWithCredentialAsync(Credential credential)
Links the user with the given 3rd party credentials.
ReauthenticateAsync(Credential credential)
Reauthenticate using a credential.
ReloadAsync()
Refreshes the data for this user.
SendEmailVerificationAsync()
Initiates email verification for the user.
TokenAsync(bool forceRefresh)
The Java Web Token (JWT) that can be used to identify the user to the backend.
UnlinkAsync(string provider)
Unlinks the current user from the provider specified.
UpdateEmailAsync(string email)
Sets the email address for the user.
UpdatePasswordAsync(string password)
Attempts to change the password for the current user.
UpdateUserProfileAsync(UserProfile profile)
Updates a subset of user profile information.

Properties

DisplayName

string DisplayName

Gets the display name associated with the user, if any.

Email

string Email

Gets email associated with the user, if any.

IsAnonymous

bool IsAnonymous

True if user signed in anonymously.

IsEmailVerified

bool IsEmailVerified

True if the email address associated with this user has been verified.

PhotoUrl

System.Uri PhotoUrl

The photo url associated with the user, if any.

ProviderData

global::System.Collections.Generic.IEnumerable< IUserInfo > ProviderData

Gets the third party profile data associated with this user returned by the authentication server, if any.

ProviderId

string ProviderId

Gets the provider ID for the user (For example, "Facebook").

RefreshToken

string RefreshToken

Gets the raw refresh token (only for use in advanced scenarios where manually refresh of tokens is required).

UserId

string UserId

Gets the unique Firebase user ID for the user.

Note:The user's ID, unique to the Firebase project. Do NOT use this value to authenticate with your backend server, if you have one. Use User.Token instead.

Public functions

DeleteAsync

System.Threading.Tasks.Task DeleteAsync()

Deletes the user account.

Dispose

void Dispose()

LinkWithCredentialAsync

System.Threading.Tasks.Task< FirebaseUser > LinkWithCredentialAsync(
  Credential credential
)

Links the user with the given 3rd party credentials.

For example, a Facebook login access token, a Twitter token/token-secret pair. Status will be an error if the token is invalid, expired, or otherwise not accepted by the server as well as if the given 3rd party user id is already linked with another user account or if the current user is already linked with another id from the same provider.

ReauthenticateAsync

System.Threading.Tasks.Task ReauthenticateAsync(
  Credential credential
)

Reauthenticate using a credential.

Some APIs (for example, UpdatePasswordAsync, DeleteAsync) require that the token used to invoke them be from a recent login attempt. This API takes an existing credential for the user and retrieves fresh tokens, ensuring that the operation can proceed. Developers can call this method prior to calling UpdatePasswordAsync() to ensure success.

Returns an error if the existing credential is not for this user or if sign-in with that credential failed. The user should remain signed in even if this method failed. If the developer had held a reference to that user, the reference will continue to be valid after this operation.

ReloadAsync

System.Threading.Tasks.Task ReloadAsync()

Refreshes the data for this user.

For example, the attached providers, email address, display name, etc.

SendEmailVerificationAsync

System.Threading.Tasks.Task SendEmailVerificationAsync()

Initiates email verification for the user.

TokenAsync

System.Threading.Tasks.Task< string > TokenAsync(
  bool forceRefresh
)

The Java Web Token (JWT) that can be used to identify the user to the backend.

If a current ID token is still believed to be valid (i.e. it has not yet expired), that token will be returned immediately. A developer may set the optional forceRefresh flag to get a new ID token, whether or not the existing token has expired. For example, a developer may use this when they have discovered that the token is invalid for some other reason.

UnlinkAsync

System.Threading.Tasks.Task< FirebaseUser > UnlinkAsync(
  string provider
)

Unlinks the current user from the provider specified.

Status will be an error if the user is not linked to the given provider.

UpdateEmailAsync

System.Threading.Tasks.Task UpdateEmailAsync(
  string email
)

Sets the email address for the user.

May fail if there is already an email/password-based account for the same email address.

UpdatePasswordAsync

System.Threading.Tasks.Task UpdatePasswordAsync(
  string password
)

Attempts to change the password for the current user.

For an account linked to an Identity Provider (IDP) with no password, this will result in the account becoming an email/password-based account while maintaining the IDP link. May fail if the password is invalid, if there is a conflicting email/password-based account, or if the token has expired. To retrieve fresh tokens, call ReauthenticateAsync.

UpdateUserProfileAsync

System.Threading.Tasks.Task UpdateUserProfileAsync(
  UserProfile profile
)

Updates a subset of user profile information.

Send feedback about...

Need help? Visit our support page.