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.
LinkAndRetrieveDataWithCredentialAsync(Credential credential)
async Task< SignInResult >
Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use LinkWithCredentialAsync(Credential) instead.
LinkWithCredentialAsync(Credential credential)
async Task< AuthResult >
Associates a user account from a third-party identity provider.
LinkWithCredentialAsync_DEPRECATED(Credential credential)
async Task< FirebaseUser >
Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use LinkWithCredentialAsync(Credential) instead.
LinkWithProviderAsync(FederatedAuthProvider provider)
async Task< AuthResult >
Link a user via a federated auth provider.
LinkWithProviderAsync_DEPRECATED(FederatedAuthProvider provider)
async Task< SignInResult >
Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use LinkWithProviderAsync(FederatedAuthProvider) instead.
ReauthenticateAndRetrieveDataAsync(Credential credential)
async Task< AuthResult >
Reauthenticate using a credential.
ReauthenticateAndRetrieveDataAsync_DEPRECATED(Credential credential)
async Task< SignInResult >
Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use ReauthenticateAndRetrieveDataAsync(Credential) instead.
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.
ReauthenticateWithProviderAsync_DEPRECATED(FederatedAuthProvider provider)
async Task< SignInResult >
Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use ReauthenticateWithProviderAsync(FederatedAuthProvider) instead.
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.
UnlinkAsync_DEPRECATED(string provider)
async Task< FirebaseUser >
Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use UnlinkAsync(string) instead.
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.
UpdatePhoneNumberCredentialAsync_DEPRECATED(Credential credential)
async Task< FirebaseUser >
Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use UpdatePhoneNumberCredentialAsync(PhoneAuthCredential) instead.
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.

LinkAndRetrieveDataWithCredentialAsync

async Task< SignInResult > LinkAndRetrieveDataWithCredentialAsync(
  Credential credential
)

Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use LinkWithCredentialAsync(Credential) instead.

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.

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

LinkWithCredentialAsync

async Task< AuthResult > LinkWithCredentialAsync(
  Credential credential
)

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

LinkWithCredentialAsync_DEPRECATED

async Task< FirebaseUser > LinkWithCredentialAsync_DEPRECATED(
  Credential credential
)

Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use LinkWithCredentialAsync(Credential) instead.

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.

LinkWithProviderAsync_DEPRECATED

async Task< SignInResult > LinkWithProviderAsync_DEPRECATED(
  FederatedAuthProvider provider
)

Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use LinkWithProviderAsync(FederatedAuthProvider) instead.

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.

ReauthenticateAndRetrieveDataAsync_DEPRECATED

async Task< SignInResult > ReauthenticateAndRetrieveDataAsync_DEPRECATED(
  Credential credential
)

Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use ReauthenticateAndRetrieveDataAsync(Credential) instead.

Reauthenticate using a credential.

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

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.

ReauthenticateWithProviderAsync_DEPRECATED

async Task< SignInResult > ReauthenticateWithProviderAsync_DEPRECATED(
  FederatedAuthProvider provider
)

Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use ReauthenticateWithProviderAsync(FederatedAuthProvider) instead.

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.

UnlinkAsync_DEPRECATED

async Task< FirebaseUser > UnlinkAsync_DEPRECATED(
  string provider
)

Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use UnlinkAsync(string) instead.

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.

UpdatePhoneNumberCredentialAsync_DEPRECATED

async Task< FirebaseUser > UpdatePhoneNumberCredentialAsync_DEPRECATED(
  Credential credential
)

Deprecated. This method is deprecated in favor of methods that return Task<AuthResult>. Please use UpdatePhoneNumberCredentialAsync(PhoneAuthCredential) instead.

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_DEPRECATED(phoneCredential.Provider) and then LinkWithCredentialAsync_DEPRECATED(phoneCredential). phoneCredential must have been created with PhoneAuthProvider.

UpdateUserProfileAsync

Task UpdateUserProfileAsync(
  UserProfile profile
)

Updates a subset of user profile information.