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.UserInfoInterface

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
Returns true if user signed in anonymously.
IsEmailVerified
bool
Returns true if the email address associated with this user has been verified.
Metadata
Gets the metadata for this user account.
PhoneNumber
string
Gets the phone number for the user, in E.164 format.
PhotoUrl
System.Uri
The photo url associated with the user, if any.
ProviderData
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").
UserId
string
Gets the unique Firebase user ID for the user.

Public functions

DeleteAsync()
System.Threading.Tasks.Task
Deletes the user account.
IsValid()
bool
Returns whether this FirebaseUser object represents a valid user.
LinkWithCredentialAsync(Credential credential)
async Task< AuthResult >
Associates a user account from a third-party identity provider.
LinkWithProviderAsync(FederatedAuthProvider provider)
async Task< AuthResult >
Link a user via a federated auth provider.
ReauthenticateAndRetrieveDataAsync(Credential credential)
async Task< AuthResult >
Reauthenticate using a credential.
ReauthenticateAsync(Credential credential)
Task
Convenience function for ReauthenticateAndRetrieveData that discards the returned AdditionalUserInfo data.
ReauthenticateWithProviderAsync(FederatedAuthProvider provider)
async Task< AuthResult >
Reauthenticate a user via a federated auth provider.
ReloadAsync()
System.Threading.Tasks.Task
Refreshes the data for this user.
SendEmailVerificationAsync()
Task
Initiates email verification for the user.
SendEmailVerificationBeforeUpdatingEmailAsync(string email)
Task
Send an email to verify the ownership of the account, then update to the new email.
TokenAsync(bool forceRefresh)
Task< string >
The Java Web Token (JWT) that can be used to identify the user to the backend.
UnlinkAsync(string provider)
async Task< AuthResult >
Unlinks the current user from the provider specified.
UpdateEmailAsync(string email)
Task
Deprecated. This method is deprecated. Please use SendEmailVerificationBeforeUpdatingEmailAsync(string) instead.
UpdatePasswordAsync(string password)
Task
Attempts to change the password for the current user.
UpdatePhoneNumberCredentialAsync(PhoneAuthCredential credential)
async Task< FirebaseUser >
Updates the currently linked phone number on the user.
UpdateUserProfileAsync(UserProfile profile)
Task
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

Returns true if user signed in anonymously.

IsEmailVerified

bool IsEmailVerified

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

Metadata

UserMetadata Metadata

Gets the metadata for this user account.

PhoneNumber

string PhoneNumber

Gets the phone number for the user, in E.164 format.

PhotoUrl

System.Uri PhotoUrl

The photo url associated with the user, if any.

ProviderData

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").

UserId

string UserId

Gets the unique Firebase user ID for the user.

Public functions

DeleteAsync

System.Threading.Tasks.Task DeleteAsync()

Deletes the user account.

IsValid

bool IsValid()

Returns whether this FirebaseUser object represents a valid user.

Could be false on FirebaseUsers contained with AuthResult structures from failed Auth operations.

LinkWithCredentialAsync

async Task< AuthResult > LinkWithCredentialAsync(
  Credential credential
)

Associates a user account from a third-party identity provider.

LinkWithProviderAsync

async Task< AuthResult > LinkWithProviderAsync(
  FederatedAuthProvider provider
)

Link a user via a federated auth provider.

ReauthenticateAndRetrieveDataAsync

async Task< AuthResult > ReauthenticateAndRetrieveDataAsync(
  Credential credential
)

Reauthenticate using a credential.

Data from the Identity Provider used to sign-in is returned in the AdditionalUserInfo inside the returned AuthResult.

Returns an error if the existing credential is not for this user or if sign-in with that credential failed.

ReauthenticateAsync

Task ReauthenticateAsync(
  Credential credential
)

Convenience function for ReauthenticateAndRetrieveData that discards the returned AdditionalUserInfo data.

ReauthenticateWithProviderAsync

async Task< AuthResult > ReauthenticateWithProviderAsync(
  FederatedAuthProvider provider
)

Reauthenticate a user via a federated auth provider.

ReloadAsync

System.Threading.Tasks.Task ReloadAsync()

Refreshes the data for this user.

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

SendEmailVerificationAsync

Task SendEmailVerificationAsync()

Initiates email verification for the user.

SendEmailVerificationBeforeUpdatingEmailAsync

Task SendEmailVerificationBeforeUpdatingEmailAsync(
  string email
)

Send an email to verify the ownership of the account, then update to the new email.

TokenAsync

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 force_refresh 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

async Task< AuthResult > 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

Task UpdateEmailAsync(
  string email
)

Deprecated. This method is deprecated. Please use SendEmailVerificationBeforeUpdatingEmailAsync(string) instead.

Sets the email address for the user.

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

UpdatePasswordAsync

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.

UpdatePhoneNumberCredentialAsync

async Task< FirebaseUser > UpdatePhoneNumberCredentialAsync(
  PhoneAuthCredential credential
)

Updates the currently linked phone number on the user.

This is useful when a user wants to change their phone number. It is a shortcut to calling UnlinkAsync(phoneCredential.Provider) and then LinkWithCredentialAsync(phoneCredential). phoneCredential must have been created with PhoneAuthProvider.

UpdateUserProfileAsync

Task UpdateUserProfileAsync(
  UserProfile profile
)

Updates a subset of user profile information.