前往主控台

firebase::auth::User

#include <user.h>

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

Constructors and Destructors

~User()

Public functions

Delete()
Future< void >
Deletes the user account.
DeleteLastResult() const
Future< void >
Get results of the most recent call to Delete.
GetToken(bool force_refresh)
Future< std::string >
The Java Web Token (JWT) that can be used to identify the user to the backend.
GetTokenLastResult() const
Future< std::string >
Get results of the most recent call to GetToken.
LinkAndRetrieveDataWithCredential(const Credential & credential)
Links the user with the given 3rd party credentials.
LinkAndRetrieveDataWithCredentialLastResult() const
Get results of the most recent call to LinkAndRetrieveDataWithCredential.
LinkWithCredential(const Credential & credential)
Future< User * >
Convenience function for ReauthenticateAndRetrieveData that discards the returned AdditionalUserInfo in SignInResult.
LinkWithCredentialLastResult() const
Future< User * >
Get results of the most recent call to LinkWithCredential.
Reauthenticate(const Credential & credential)
Future< void >
Convenience function for ReauthenticateAndRetrieveData that discards the returned AdditionalUserInfo data.
ReauthenticateAndRetrieveData(const Credential & credential)
Reauthenticate using a credential.
ReauthenticateAndRetrieveDataLastResult() const
Get results of the most recent call to ReauthenticateAndRetrieveData.
ReauthenticateLastResult() const
Future< void >
Get results of the most recent call to Reauthenticate.
Reload()
Future< void >
Refreshes the data for this user.
ReloadLastResult() const
Future< void >
Get results of the most recent call to Reload.
SendEmailVerification()
Future< void >
Initiates email verification for the user.
SendEmailVerificationLastResult() const
Future< void >
Get results of the most recent call to SendEmailVerification.
Unlink(const char *provider)
Future< User * >
Unlinks the current user from the provider specified.
UnlinkLastResult() const
Future< User * >
Get results of the most recent call to Unlink.
UpdateEmail(const char *email)
Future< void >
Sets the email address for the user.
UpdateEmailLastResult() const
Future< void >
Get results of the most recent call to UpdateEmail.
UpdatePassword(const char *password)
Future< void >
Attempts to change the password for the current user.
UpdatePasswordLastResult() const
Future< void >
Get results of the most recent call to UpdatePassword.
UpdatePhoneNumberCredential(const Credential & credential)
Future< User * >
Updates the currently linked phone number on the user.
UpdatePhoneNumberCredentialLastResult() const
Future< User * >
Get results of the most recent call to UpdatePhoneNumberCredential.
UpdateUserProfile(const UserProfile & profile)
Future< void >
Updates a subset of user profile information.
UpdateUserProfileLastResult() const
Future< void >
Get results of the most recent call to UpdateUserProfile.
display_name() const
virtual std::string
Gets the display name associated with the user, if any.
email() const
virtual std::string
Gets email associated with the user, if any.
is_anonymous() const
bool
Returns true if user signed in anonymously.
is_email_verified() const
bool
Returns true if the email address associated with this user has been verified.
metadata() const
Gets the metadata for this user account.
phone_number() const
virtual std::string
Gets the phone number for the user, in E.164 format.
photo_url() const
virtual std::string
Gets the photo url associated with the user, if any.
provider_data() const
const std::vector< UserInfoInterface * > &
Gets the third party profile data associated with this user returned by the authentication server, if any.
provider_id() const
virtual std::string
Gets the provider ID for the user (For example, "Facebook").
uid() const
virtual std::string
Gets the unique Firebase user ID for the user.

Structs

firebase::auth::User::UserProfile

Parameters to the UpdateUserProfile() function.

Public functions

Delete

Future< void > Delete()

Deletes the user account.

DeleteLastResult

Future< void > DeleteLastResult() const 

Get results of the most recent call to Delete.

GetToken

Future< std::string > GetToken(
  bool force_refresh
)

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.

GetTokenLastResult

Future< std::string > GetTokenLastResult() const 

Get results of the most recent call to GetToken.

LinkAndRetrieveDataWithCredential

Future< SignInResult > LinkAndRetrieveDataWithCredential(
  const 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.

LinkAndRetrieveDataWithCredentialLastResult

Future< SignInResult > LinkAndRetrieveDataWithCredentialLastResult() const 

Get results of the most recent call to LinkAndRetrieveDataWithCredential.

LinkWithCredential

Future< User * > LinkWithCredential(
  const Credential & credential
)

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

LinkWithCredentialLastResult

Future< User * > LinkWithCredentialLastResult() const 

Get results of the most recent call to LinkWithCredential.

Reauthenticate

Future< void > Reauthenticate(
  const Credential & credential
)

Convenience function for ReauthenticateAndRetrieveData that discards the returned AdditionalUserInfo data.

ReauthenticateAndRetrieveData

Future< SignInResult > ReauthenticateAndRetrieveData(
  const Credential & credential
)

Reauthenticate using a credential.

Some APIs (for example, UpdatePassword, Delete) 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 UpdatePassword() to ensure success.

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

Returns an er