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.
Metadata
PhoneNumber
string
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").
UserId
string
Gets the unique Firebase user ID for the user.

Public functions

DeleteAsync()
Deletes the user account.
Dispose()
void
LinkAndRetrieveDataWithCredentialAsync(Credential credential)
Links the user with the given 3rd party credentials.
LinkWithCredentialAsync(Credential credential)
Convenience function for ReauthenticateAndRetrieveData that discards the returned AdditionalUserInfo in SignInResult.
ReauthenticateAndRetrieveDataAsync(Credential credential)
Reauthenticate using a credential.
ReauthenticateAsync(Credential credential)
Convenience function for ReauthenticateAndRetrieveData that discards the returned AdditionalUserInfo data.
ReloadAsync()
Refreshes the data for this user.
SendEmailVerificationAsync()
Initiates email verification for the user.
TokenAsync(bool forceRefresh)
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.
UpdatePhoneNumberCredentialAsync(Credential credential)
Updates the currently linked phone number on the 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.

Metadata

UserMetadata Metadata

PhoneNumber

string PhoneNumber

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

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()

LinkAndRetrieveDataWithCredentialAsync

System.Threading.Tasks.Task< SignInResult > LinkAndRetrieveDataWithCredentialAsync(
  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.

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

LinkWithCredentialAsync

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

Convenience function for ReauthenticateAndRetrieveData that discards the returned AdditionalUserInfo in SignInResult.

ReauthenticateAndRetrieveDataAsync

System.Threading.Tasks.Task< SignInResult > ReauthenticateAndRetrieveDataAsync(
  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.

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

ReauthenticateAsync

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

Convenience function for ReauthenticateAndRetrieveData that discards the returned AdditionalUserInfo data.

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
)

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.

UpdatePhoneNumberCredentialAsync

System.Threading.Tasks.Task< FirebaseUser > UpdatePhoneNumberCredentialAsync(
  Credential 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 Unlink(phone_credential.provider().c_str()) and then LinkWithCredential(phone_credential). credential must have been created with PhoneAuthProvider.

UpdateUserProfileAsync

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

Updates a subset of user profile information.

发送以下问题的反馈:

此网页
需要帮助?请访问我们的支持页面