Known Direct Subclasses |
This is the abstract class for server-side Firebase Authentication actions.
Nested Class Summary
class | AbstractFirebaseAuth.Builder<T extends Builder<T>> |
Protected Constructor Summary
AbstractFirebaseAuth(Builder<?> builder)
|
Public Method Summary
String |
createCustomToken(String uid)
Creates a Firebase custom token for the given UID.
|
String |
createCustomToken(String uid, Map<String, Object> developerClaims)
Creates a Firebase custom token for the given UID, containing the specified additional claims.
|
ApiFuture<String> |
createCustomTokenAsync(String uid, Map<String, Object> developerClaims)
Similar to
createCustomToken(String, Map) but performs the operation asynchronously. |
ApiFuture<String> |
createCustomTokenAsync(String uid)
Similar to
createCustomToken(String) but performs the operation asynchronously. |
OidcProviderConfig |
createOidcProviderConfig(OidcProviderConfig.CreateRequest request)
Creates a new OpenID Connect auth provider config with the attributes contained in the
specified
OidcProviderConfig.CreateRequest . |
ApiFuture<OidcProviderConfig> |
createOidcProviderConfigAsync(OidcProviderConfig.CreateRequest request)
Similar to
createOidcProviderConfig(OidcProviderConfig.CreateRequest) but performs the operation asynchronously. |
SamlProviderConfig |
createSamlProviderConfig(SamlProviderConfig.CreateRequest request)
Creates a new SAML Auth provider config with the attributes contained in the specified
SamlProviderConfig.CreateRequest . |
ApiFuture<SamlProviderConfig> |
createSamlProviderConfigAsync(SamlProviderConfig.CreateRequest request)
Similar to
createSamlProviderConfig(SamlProviderConfig.CreateRequest) but performs the operation asynchronously. |
String |
createSessionCookie(String idToken, SessionCookieOptions options)
Creates a new Firebase session cookie from the given ID token and options.
|
ApiFuture<String> |
createSessionCookieAsync(String idToken, SessionCookieOptions options)
Similar to
createSessionCookie(String, SessionCookieOptions) but performs the
operation asynchronously. |
UserRecord |
createUser(UserRecord.CreateRequest request)
Creates a new user account with the attributes contained in the specified
UserRecord.CreateRequest . |
ApiFuture<UserRecord> |
createUserAsync(UserRecord.CreateRequest request)
Similar to
createUser(UserRecord.CreateRequest) but performs the operation asynchronously. |
void |
deleteOidcProviderConfig(String providerId)
Deletes the OpenID Connect auth provider config identified by the specified provider ID.
|
ApiFuture<Void> |
deleteOidcProviderConfigAsync(String providerId)
Similar to
deleteOidcProviderConfig(String) but performs the operation asynchronously. |
void |
deleteSamlProviderConfig(String providerId)
Deletes the SAML Auth provider config identified by the specified provider ID.
|
ApiFuture<Void> |
deleteSamlProviderConfigAsync(String providerId)
Similar to
deleteSamlProviderConfig(String) but performs the operation asynchronously. |
void |
deleteUser(String uid)
Deletes the user identified by the specified user ID.
|
ApiFuture<Void> |
deleteUserAsync(String uid)
Similar to
deleteUser(String) but performs the operation asynchronously. |
DeleteUsersResult |
deleteUsers(List<String> uids)
Deletes the users specified by the given identifiers.
|
ApiFuture<DeleteUsersResult> |
deleteUsersAsync(List<String> uids)
Similar to
deleteUsers(List) but performs the operation asynchronously. |
String |
generateEmailVerificationLink(String email, ActionCodeSettings settings)
Generates the out-of-band email action link for email verification flows for the specified
email address, using the action code settings provided.
|
String |
generateEmailVerificationLink(String email)
Generates the out-of-band email action link for email verification flows for the specified
email address.
|
ApiFuture<String> |
generateEmailVerificationLinkAsync(String email, ActionCodeSettings settings)
Similar to
generateEmailVerificationLink(String, ActionCodeSettings) but performs the
operation asynchronously. |
ApiFuture<String> |
generateEmailVerificationLinkAsync(String email)
Similar to
generateEmailVerificationLink(String) but performs the operation
asynchronously. |
String |
generatePasswordResetLink(String email, ActionCodeSettings settings)
Generates the out-of-band email action link for password reset flows for the specified email
address.
|
String |
generatePasswordResetLink(String email)
Generates the out-of-band email action link for password reset flows for the specified email
address.
|
ApiFuture<String> |
generatePasswordResetLinkAsync(String email, ActionCodeSettings settings)
Similar to
generatePasswordResetLink(String, ActionCodeSettings) but performs the
operation asynchronously. |
ApiFuture<String> |
generatePasswordResetLinkAsync(String email)
Similar to
generatePasswordResetLink(String) but performs the operation
asynchronously. |
String |
generateSignInWithEmailLink(String email, ActionCodeSettings settings)
Generates the out-of-band email action link for email link sign-in flows, using the action code
settings provided.
|
ApiFuture<String> |
generateSignInWithEmailLinkAsync(String email, ActionCodeSettings settings)
Similar to
generateSignInWithEmailLink(String, ActionCodeSettings) but performs the
operation asynchronously. |
OidcProviderConfig |
getOidcProviderConfig(String providerId)
Gets the OpenID Connect auth provider corresponding to the specified provider ID.
|
ApiFuture<OidcProviderConfig> |
getOidcProviderConfigAsync(String providerId)
Similar to
getOidcProviderConfig(String) but performs the operation asynchronously. |
SamlProviderConfig |
getSamlProviderConfig(String providerId)
Gets the SAML Auth provider config corresponding to the specified provider ID.
|
ApiFuture<SamlProviderConfig> |
getSamlProviderConfigAsync(String providerId)
Similar to
getSamlProviderConfig(String) but performs the operation asynchronously. |
UserRecord |
getUser(String uid)
Gets the user data corresponding to the specified user ID.
|
ApiFuture<UserRecord> |
getUserAsync(String uid)
Similar to
getUser(String) but performs the operation asynchronously. |
UserRecord |
getUserByEmail(String email)
Gets the user data corresponding to the specified user email.
|
ApiFuture<UserRecord> |
getUserByEmailAsync(String email)
Similar to
getUserByEmail(String) but performs the operation asynchronously. |
UserRecord |
getUserByPhoneNumber(String phoneNumber)
Gets the user data corresponding to the specified user phone number.
|
ApiFuture<UserRecord> |
getUserByPhoneNumberAsync(String phoneNumber)
Gets the user data corresponding to the specified user phone number.
|
UserRecord |
getUserByProviderUid(String providerId, String uid)
Gets the user data for the user corresponding to a given provider ID.
|
ApiFuture<UserRecord> |
getUserByProviderUidAsync(String providerId, String uid)
Gets the user data for the user corresponding to a given provider ID.
|
GetUsersResult |
getUsers(Collection<UserIdentifier> identifiers)
Gets the user data corresponding to the specified identifiers.
|
ApiFuture<GetUsersResult> |
getUsersAsync(Collection<UserIdentifier> identifiers)
Gets the user data corresponding to the specified identifiers.
|
UserImportResult | |
UserImportResult |
importUsers(List<ImportUserRecord> users, UserImportOptions options)
Imports the provided list of users into Firebase Auth.
|
ApiFuture<UserImportResult> |
importUsersAsync(List<ImportUserRecord> users)
Similar to
importUsers(List) but performs the operation asynchronously. |
ApiFuture<UserImportResult> |
importUsersAsync(List<ImportUserRecord> users, UserImportOptions options)
Similar to
importUsers(List, UserImportOptions) but performs the operation
asynchronously. |
ListProviderConfigsPage<OidcProviderConfig> |
listOidcProviderConfigs(String pageToken)
Gets a page of OpenID Connect auth provider configs starting from the specified
pageToken . |
ListProviderConfigsPage<OidcProviderConfig> |
listOidcProviderConfigs(String pageToken, int maxResults)
Gets a page of OpenID Connect auth provider configs starting from the specified
pageToken . |
ApiFuture<ListProviderConfigsPage<OidcProviderConfig>> |
listOidcProviderConfigsAsync(String pageToken)
Similar to
listOidcProviderConfigs(String) but performs the operation asynchronously. |
ApiFuture<ListProviderConfigsPage<OidcProviderConfig>> |
listOidcProviderConfigsAsync(String pageToken, int maxResults)
Similar to
listOidcProviderConfigs(String, int) but performs the operation
asynchronously. |
ListProviderConfigsPage<SamlProviderConfig> |
listSamlProviderConfigs(String pageToken)
Gets a page of SAML Auth provider configs starting from the specified
pageToken . |
ListProviderConfigsPage<SamlProviderConfig> |
listSamlProviderConfigs(String pageToken, int maxResults)
Gets a page of SAML Auth provider configs starting from the specified
pageToken . |
ApiFuture<ListProviderConfigsPage<SamlProviderConfig>> |
listSamlProviderConfigsAsync(String pageToken)
Similar to
listSamlProviderConfigs(String) but performs the operation asynchronously. |
ApiFuture<ListProviderConfigsPage<SamlProviderConfig>> |
listSamlProviderConfigsAsync(String pageToken, int maxResults)
Similar to
listSamlProviderConfigs(String, int) but performs the operation
asynchronously. |
ListUsersPage |
listUsers(String pageToken, int maxResults)
Gets a page of users starting from the specified
pageToken . |
ListUsersPage |
listUsers(String pageToken)
Gets a page of users starting from the specified
pageToken . |
ApiFuture<ListUsersPage> |
listUsersAsync(String pageToken, int maxResults)
Similar to
listUsers(String, int) but performs the operation asynchronously. |
ApiFuture<ListUsersPage> |
listUsersAsync(String pageToken)
Similar to
listUsers(String) but performs the operation asynchronously. |
void |
revokeRefreshTokens(String uid)
Revokes all refresh tokens for the specified user.
|
ApiFuture<Void> |
revokeRefreshTokensAsync(String uid)
Similar to
revokeRefreshTokens(String) but performs the operation asynchronously. |
void |
setCustomClaims(String uid, Map<String, Object> claims)
This method is deprecated.
Use
setCustomUserClaims(String, Map) instead.
|
void |
setCustomUserClaims(String uid, Map<String, Object> claims)
Sets the specified custom claims on an existing user account.
|
ApiFuture<Void> |
setCustomUserClaimsAsync(String uid, Map<String, Object> claims)
Similar to
setCustomUserClaims(String, Map) but performs the operation asynchronously. |
OidcProviderConfig |
updateOidcProviderConfig(OidcProviderConfig.UpdateRequest request)
Updates an existing OpenID Connect auth provider config with the attributes contained in the
specified
OidcProviderConfig.UpdateRequest . |
ApiFuture<OidcProviderConfig> |
updateOidcProviderConfigAsync(OidcProviderConfig.UpdateRequest request)
Similar to
updateOidcProviderConfig(OidcProviderConfig.UpdateRequest) but performs the operation asynchronously. |
SamlProviderConfig |
updateSamlProviderConfig(SamlProviderConfig.UpdateRequest request)
Updates an existing SAML Auth provider config with the attributes contained in the specified
SamlProviderConfig.UpdateRequest . |
ApiFuture<SamlProviderConfig> |
updateSamlProviderConfigAsync(SamlProviderConfig.UpdateRequest request)
Similar to
updateSamlProviderConfig(SamlProviderConfig.UpdateRequest) but performs the operation asynchronously. |
UserRecord |
updateUser(UserRecord.UpdateRequest request)
Updates an existing user account with the attributes contained in the specified
UserRecord.UpdateRequest . |
ApiFuture<UserRecord> |
updateUserAsync(UserRecord.UpdateRequest request)
Similar to
updateUser(UserRecord.UpdateRequest) but performs the operation asynchronously. |
FirebaseToken |
verifyIdToken(String idToken, boolean checkRevoked)
Parses and verifies a Firebase ID Token.
|
FirebaseToken |
verifyIdToken(String idToken)
Parses and verifies a Firebase ID Token.
|
ApiFuture<FirebaseToken> |
verifyIdTokenAsync(String idToken)
Similar to
verifyIdToken(String) but performs the operation asynchronously. |
ApiFuture<FirebaseToken> |
verifyIdTokenAsync(String idToken, boolean checkRevoked)
Similar to
verifyIdToken(String, boolean) but performs the operation asynchronously. |
FirebaseToken |
verifySessionCookie(String cookie, boolean checkRevoked)
Parses and verifies a Firebase session cookie.
|
FirebaseToken |
verifySessionCookie(String cookie)
Parses and verifies a Firebase session cookie.
|
ApiFuture<FirebaseToken> |
verifySessionCookieAsync(String cookie, boolean checkRevoked)
Similar to
verifySessionCookie(String, boolean) but performs the operation
asynchronously. |
ApiFuture<FirebaseToken> |
verifySessionCookieAsync(String cookie)
Similar to
verifySessionCookie(String) but performs the operation asynchronously. |
Protected Method Summary
static <T extends Builder<T>> T |
Inherited Method Summary
Protected Constructors
Public Methods
public String createCustomToken (String uid)
Creates a Firebase custom token for the given UID. This token can then be sent back to a client application to be used with the signInWithCustomToken authentication API.
FirebaseApp
must have been initialized with service account credentials to use call
this method.
Parameters
uid | The UID to store in the token. This identifies the user to other Firebase services (Realtime Database, Firebase Auth, etc.). Should be less than 128 characters. |
---|
Returns
- A Firebase custom token string.
Throws
IllegalArgumentException | If the specified uid is null or empty, or if the app has not been initialized with service account credentials. |
---|---|
FirebaseAuthException | If an error occurs while generating the custom token. |
public String createCustomToken (String uid, Map<String, Object> developerClaims)
Creates a Firebase custom token for the given UID, containing the specified additional claims. This token can then be sent back to a client application to be used with the signInWithCustomToken authentication API.
This method attempts to generate a token using:
- the private key of
FirebaseApp
's service account credentials, if provided at initialization. - the IAM
service if a service account email was specified via
setServiceAccountId(String)
. - the App Identity service if the code is deployed in the Google App Engine standard environment.
- the local Metadata server if the code is deployed in a different GCP-managed environment like Google Compute Engine.
This method throws an exception when all the above fail.
Parameters
uid | The UID to store in the token. This identifies the user to other Firebase services (Realtime Database, Firebase Auth, etc.). Should be less than 128 characters. |
---|---|
developerClaims | Additional claims to be stored in the token (and made available to security rules in Database, Storage, etc.). These must be able to be serialized to JSON (e.g. contain only Maps, Arrays, Strings, Booleans, Numbers, etc.) |
Returns
- A Firebase custom token string.
Throws
IllegalArgumentException | If the specified uid is null or empty. |
---|---|
IllegalStateException | If the SDK fails to discover a viable approach for signing tokens. |
FirebaseAuthException | If an error occurs while generating the custom token. |
public ApiFuture<String> createCustomTokenAsync (String uid, Map<String, Object> developerClaims)
Similar to createCustomToken(String, Map)
but performs the operation asynchronously.
Parameters
uid | The UID to store in the token. This identifies the user to other Firebase services (Realtime Database, Storage, etc.). Should be less than 128 characters. |
---|---|
developerClaims | Additional claims to be stored in the token (and made available to security rules in Database, Storage, etc.). These must be able to be serialized to JSON (e.g. contain only Maps, Arrays, Strings, Booleans, Numbers, etc.) |
Returns
- An
ApiFuture
which will complete successfully with the created Firebase custom token, or unsuccessfully with the failure Exception.
Throws
IllegalArgumentException | If the specified uid is null or empty, or if the app has not been initialized with service account credentials. |
---|
public ApiFuture<String> createCustomTokenAsync (String uid)
Similar to createCustomToken(String)
but performs the operation asynchronously.
Parameters
uid | The UID to store in the token. This identifies the user to other Firebase services (Realtime Database, Firebase Auth, etc.). Should be less than 128 characters. |
---|
Returns
- An
ApiFuture
which will complete successfully with the created Firebase custom token, or unsuccessfully with the failure Exception.
Throws
IllegalArgumentException | If the specified uid is null or empty, or if the app has not been initialized with service account credentials. |
---|
public OidcProviderConfig createOidcProviderConfig (OidcProviderConfig.CreateRequest request)
Creates a new OpenID Connect auth provider config with the attributes contained in the
specified OidcProviderConfig.CreateRequest
.
Parameters
request | A non-null OidcProviderConfig.CreateRequest instance. |
---|
Returns
- An
OidcProviderConfig
instance corresponding to the newly created provider config.
Throws
NullPointerException | if the provided request is null. |
---|---|
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with 'oidc.'. |
FirebaseAuthException | if an error occurs while creating the provider config. |
public ApiFuture<OidcProviderConfig> createOidcProviderConfigAsync (OidcProviderConfig.CreateRequest request)
Similar to createOidcProviderConfig(OidcProviderConfig.CreateRequest)
but performs the operation asynchronously.
Parameters
request | A non-null OidcProviderConfig.CreateRequest instance. |
---|
Returns
- An
ApiFuture
which will complete successfully with aOidcProviderConfig
instance corresponding to the newly created provider config. If an error occurs while creating the provider config, the future throws aFirebaseAuthException
.
Throws
NullPointerException | if the provided request is null. |
---|---|
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with 'oidc.'. |
public SamlProviderConfig createSamlProviderConfig (SamlProviderConfig.CreateRequest request)
Creates a new SAML Auth provider config with the attributes contained in the specified
SamlProviderConfig.CreateRequest
.
Parameters
request | A non-null SamlProviderConfig.CreateRequest instance. |
---|
Returns
- An
SamlProviderConfig
instance corresponding to the newly created provider config.
Throws
NullPointerException | if the provided request is null. |
---|---|
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with 'saml'. |
FirebaseAuthException | if an error occurs while creating the provider config. |
public ApiFuture<SamlProviderConfig> createSamlProviderConfigAsync (SamlProviderConfig.CreateRequest request)
Similar to createSamlProviderConfig(SamlProviderConfig.CreateRequest)
but performs the operation asynchronously.
Parameters
request | A non-null SamlProviderConfig.CreateRequest instance. |
---|
Returns
- An
ApiFuture
which will complete successfully with aSamlProviderConfig
instance corresponding to the newly created provider config. If an error occurs while creating the provider config, the future throws aFirebaseAuthException
.
Throws
NullPointerException | if the provided request is null. |
---|---|
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with 'saml'. |
public String createSessionCookie (String idToken, SessionCookieOptions options)
Creates a new Firebase session cookie from the given ID token and options. The returned JWT can be set as a server-side session cookie with a custom cookie policy.
Parameters
idToken | The Firebase ID token to exchange for a session cookie. |
---|---|
options | Additional options required to create the cookie. |
Returns
- A Firebase session cookie string.
Throws
IllegalArgumentException | If the ID token is null or empty, or if options is null. |
---|---|
FirebaseAuthException | If an error occurs while generating the session cookie. |
public ApiFuture<String> createSessionCookieAsync (String idToken, SessionCookieOptions options)
Similar to createSessionCookie(String, SessionCookieOptions)
but performs the
operation asynchronously.
Parameters
idToken | The Firebase ID token to exchange for a session cookie. |
---|---|
options | Additional options required to create the cookie. |
Returns
- An
ApiFuture
which will complete successfully with a session cookie string. If an error occurs while generating the cookie or if the specified ID token is invalid, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the ID token is null or empty, or if options is null. |
---|
public UserRecord createUser (UserRecord.CreateRequest request)
Creates a new user account with the attributes contained in the specified UserRecord.CreateRequest
.
Parameters
request | A non-null UserRecord.CreateRequest instance. |
---|
Returns
- A
UserRecord
instance corresponding to the newly created account.
Throws
NullPointerException | if the provided request is null. |
---|---|
FirebaseAuthException | if an error occurs while creating the user account. |
public ApiFuture<UserRecord> createUserAsync (UserRecord.CreateRequest request)
Similar to createUser(UserRecord.CreateRequest)
but performs the operation asynchronously.
Parameters
request | A non-null UserRecord.CreateRequest instance. |
---|
Returns
- An
ApiFuture
which will complete successfully with aUserRecord
instance corresponding to the newly created account. If an error occurs while creating the user account, the future throws aFirebaseAuthException
.
Throws
NullPointerException | if the provided request is null. |
---|
public void deleteOidcProviderConfig (String providerId)
Deletes the OpenID Connect auth provider config identified by the specified provider ID.
Parameters
providerId | A provider ID string. |
---|
Throws
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with 'oidc'. |
---|---|
FirebaseAuthException | If an error occurs while deleting the provider config. |
public ApiFuture<Void> deleteOidcProviderConfigAsync (String providerId)
Similar to deleteOidcProviderConfig(String)
but performs the operation asynchronously.
Parameters
providerId | A provider ID string. |
---|
Returns
- An
ApiFuture
which will complete successfully when the specified provider config has been deleted. If an error occurs while deleting the provider config, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with "oidc.". |
---|
public void deleteSamlProviderConfig (String providerId)
Deletes the SAML Auth provider config identified by the specified provider ID.
Parameters
providerId | A provider ID string. |
---|
Throws
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with "saml.". |
---|---|
FirebaseAuthException | If an error occurs while deleting the provider config. |
public ApiFuture<Void> deleteSamlProviderConfigAsync (String providerId)
Similar to deleteSamlProviderConfig(String)
but performs the operation asynchronously.
Parameters
providerId | A provider ID string. |
---|
Returns
- An
ApiFuture
which will complete successfully when the specified provider config has been deleted. If an error occurs while deleting the provider config, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with "saml.". |
---|
public void deleteUser (String uid)
Deletes the user identified by the specified user ID.
Parameters
uid | A user ID string. |
---|
Throws
IllegalArgumentException | If the user ID string is null or empty. |
---|---|
FirebaseAuthException | If an error occurs while deleting the user. |
public ApiFuture<Void> deleteUserAsync (String uid)
Similar to deleteUser(String)
but performs the operation asynchronously.
Parameters
uid | A user ID string. |
---|
Returns
- An
ApiFuture
which will complete successfully when the specified user account has been deleted. If an error occurs while deleting the user account, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the user ID string is null or empty. |
---|
public DeleteUsersResult deleteUsers (List<String> uids)
Deletes the users specified by the given identifiers.
Deleting a non-existing user does not generate an error (the method is idempotent). Non-existing users are considered to be successfully deleted and are therefore included in the DeleteUsersResult.getSuccessCount() value.
A maximum of 1000 identifiers may be supplied. If more than 1000 identifiers are
supplied, this method throws an IllegalArgumentException
.
This API has a rate limit of 1 QPS. Exceeding the limit may result in a quota exceeded error. If you want to delete more than 1000 users, we suggest adding a delay to ensure you don't exceed this limit.
Parameters
uids | The uids of the users to be deleted. Must have <= 1000 entries. |
---|
Returns
- The total number of successful/failed deletions, as well as the array of errors that correspond to the failed deletions.
Throws
IllegalArgumentException | If any of the identifiers are invalid or if more than 1000 identifiers are specified. |
---|---|
FirebaseAuthException | If an error occurs while deleting users. |
public ApiFuture<DeleteUsersResult> deleteUsersAsync (List<String> uids)
Similar to deleteUsers(List)
but performs the operation asynchronously.
Parameters
uids | The uids of the users to be deleted. Must have <= 1000 entries. |
---|
Returns
- An
ApiFuture
that resolves to the total number of successful/failed deletions, as well as the array of errors that correspond to the failed deletions. If an error occurs while deleting the user account, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If any of the identifiers are invalid or if more than 1000 identifiers are specified. |
---|
public String generateEmailVerificationLink (String email, ActionCodeSettings settings)
Generates the out-of-band email action link for email verification flows for the specified email address, using the action code settings provided.
Parameters
The email of the user to be verified. |
Returns
- An email verification link.
Throws
IllegalArgumentException | If the email address is null or empty. |
---|---|
FirebaseAuthException | If an error occurs while generating the link. |
public String generateEmailVerificationLink (String email)
Generates the out-of-band email action link for email verification flows for the specified email address.
Parameters
The email of the user to be verified. |
Returns
- An email verification link.
Throws
IllegalArgumentException | If the email address is null or empty. |
---|---|
FirebaseAuthException | If an error occurs while generating the link. |
public ApiFuture<String> generateEmailVerificationLinkAsync (String email, ActionCodeSettings settings)
Similar to generateEmailVerificationLink(String, ActionCodeSettings)
but performs the
operation asynchronously.
Parameters
The email of the user to be verified. | |
settings | The action code settings object which defines whether the link is to be handled by a mobile app and the additional state information to be passed in the deep link. |
Returns
- An
ApiFuture
which will complete successfully with the generated email action link. If an error occurs while generating the link, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the email address is null or empty. |
---|
public ApiFuture<String> generateEmailVerificationLinkAsync (String email)
Similar to generateEmailVerificationLink(String)
but performs the operation
asynchronously.
Parameters
The email of the user to be verified. |
Returns
- An
ApiFuture
which will complete successfully with the generated email action link. If an error occurs while generating the link, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the email address is null or empty. |
---|
public String generatePasswordResetLink (String email, ActionCodeSettings settings)
Generates the out-of-band email action link for password reset flows for the specified email address.
Parameters
The email of the user whose password is to be reset. | |
settings | The action code settings object which defines whether the link is to be handled by a mobile app and the additional state information to be passed in the deep link. |
Returns
- A password reset link.
Throws
IllegalArgumentException | If the email address is null or empty. |
---|---|
FirebaseAuthException | If an error occurs while generating the link. |
public String generatePasswordResetLink (String email)
Generates the out-of-band email action link for password reset flows for the specified email address.
Parameters
The email of the user whose password is to be reset. |
Returns
- A password reset link.
Throws
IllegalArgumentException | If the email address is null or empty. |
---|---|
FirebaseAuthException | If an error occurs while generating the link. |
public ApiFuture<String> generatePasswordResetLinkAsync (String email, ActionCodeSettings settings)
Similar to generatePasswordResetLink(String, ActionCodeSettings)
but performs the
operation asynchronously.
Parameters
The email of the user whose password is to be reset. | |
settings | The action code settings object which defines whether the link is to be handled by a mobile app and the additional state information to be passed in the deep link. |
Returns
- An
ApiFuture
which will complete successfully with the generated email action link. If an error occurs while generating the link, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the email address is null or empty. |
---|
public ApiFuture<String> generatePasswordResetLinkAsync (String email)
Similar to generatePasswordResetLink(String)
but performs the operation
asynchronously.
Parameters
The email of the user whose password is to be reset. |
Returns
- An
ApiFuture
which will complete successfully with the generated email action link. If an error occurs while generating the link, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the email address is null or empty. |
---|
public String generateSignInWithEmailLink (String email, ActionCodeSettings settings)
Generates the out-of-band email action link for email link sign-in flows, using the action code settings provided.
Parameters
The email of the user signing in. | |
settings | The action code settings object which defines whether the link is to be handled by a mobile app and the additional state information to be passed in the deep link. |
Returns
- An email verification link.
Throws
IllegalArgumentException | If the email address is null or empty. |
---|---|
FirebaseAuthException | If an error occurs while generating the link. |
public ApiFuture<String> generateSignInWithEmailLinkAsync (String email, ActionCodeSettings settings)
Similar to generateSignInWithEmailLink(String, ActionCodeSettings)
but performs the
operation asynchronously.
Parameters
The email of the user signing in. | |
settings | The action code settings object which defines whether the link is to be handled by a mobile app and the additional state information to be passed in the deep link. |
Returns
- An
ApiFuture
which will complete successfully with the generated email action link. If an error occurs while generating the link, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the email address is null or empty. |
---|---|
NullPointerException | If the settings is null. |
public OidcProviderConfig getOidcProviderConfig (String providerId)
Gets the OpenID Connect auth provider corresponding to the specified provider ID.
Parameters
providerId | A provider ID string. |
---|
Returns
- An
OidcProviderConfig
instance.
Throws
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with 'oidc'. |
---|---|
FirebaseAuthException | If an error occurs while retrieving the provider config. |
public ApiFuture<OidcProviderConfig> getOidcProviderConfigAsync (String providerId)
Similar to getOidcProviderConfig(String)
but performs the operation asynchronously.
Page size is limited to 100 provider configs.
Parameters
providerId | A provider ID string. |
---|
Returns
- An
ApiFuture
which will complete successfully with anOidcProviderConfig
instance. If an error occurs while retrieving the provider config or if the specified provider ID does not exist, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with 'oidc.'. |
---|
public SamlProviderConfig getSamlProviderConfig (String providerId)
Gets the SAML Auth provider config corresponding to the specified provider ID.
Parameters
providerId | A provider ID string. |
---|
Returns
- An
SamlProviderConfig
instance.
Throws
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with 'saml'. |
---|---|
FirebaseAuthException | If an error occurs while retrieving the provider config. |
public ApiFuture<SamlProviderConfig> getSamlProviderConfigAsync (String providerId)
Similar to getSamlProviderConfig(String)
but performs the operation asynchronously.
Page size is limited to 100 provider configs.
Parameters
providerId | A provider ID string. |
---|
Returns
- An
ApiFuture
which will complete successfully with anSamlProviderConfig
instance. If an error occurs while retrieving the provider config or if the specified provider ID does not exist, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the provider ID string is null or empty, or is not prefixed with 'saml'. |
---|
public UserRecord getUser (String uid)
Gets the user data corresponding to the specified user ID.
Parameters
uid | A user ID string. |
---|
Returns
- A
UserRecord
instance.
Throws
IllegalArgumentException | If the user ID string is null or empty. |
---|---|
FirebaseAuthException | If an error occurs while retrieving user data. |
public ApiFuture<UserRecord> getUserAsync (String uid)
Similar to getUser(String)
but performs the operation asynchronously.
Parameters
uid | A user ID string. |
---|
Returns
- An
ApiFuture
which will complete successfully with aUserRecord
instance. If an error occurs while retrieving user data or if the specified user ID does not exist, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the user ID string is null or empty. |
---|
public UserRecord getUserByEmail (String email)
Gets the user data corresponding to the specified user email.
Parameters
A user email address string. |
Returns
- A
UserRecord
instance.
Throws
IllegalArgumentException | If the email is null or empty. |
---|---|
FirebaseAuthException | If an error occurs while retrieving user data. |
public ApiFuture<UserRecord> getUserByEmailAsync (String email)
Similar to getUserByEmail(String)
but performs the operation asynchronously.
Parameters
A user email address string. |
Returns
- An
ApiFuture
which will complete successfully with aUserRecord
instance. If an error occurs while retrieving user data or if the email address does not correspond to a user, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the email is null or empty. |
---|
public UserRecord getUserByPhoneNumber (String phoneNumber)
Gets the user data corresponding to the specified user phone number.
Parameters
phoneNumber | A user phone number string. |
---|
Returns
- A a
UserRecord
instance.
Throws
IllegalArgumentException | If the phone number is null or empty. |
---|---|
FirebaseAuthException | If an error occurs while retrieving user data. |
public ApiFuture<UserRecord> getUserByPhoneNumberAsync (String phoneNumber)
Gets the user data corresponding to the specified user phone number.
Parameters
phoneNumber | A user phone number string. |
---|
Returns
- An
ApiFuture
which will complete successfully with aUserRecord
instance. If an error occurs while retrieving user data or if the phone number does not correspond to a user, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the phone number is null or empty. |
---|
public UserRecord getUserByProviderUid (String providerId, String uid)
Gets the user data for the user corresponding to a given provider ID.
Parameters
providerId | Identifier for the given federated provider: for example, "google.com" for the Google provider. |
---|---|
uid | The user identifier with the given provider. |
Returns
- A
UserRecord
instance.
Throws
IllegalArgumentException | If the uid is null or empty, or if the providerId is null, empty, or does not belong to a federated provider. |
---|---|
FirebaseAuthException | If an error occurs while retrieving user data. |
public ApiFuture<UserRecord> getUserByProviderUidAsync (String providerId, String uid)
Gets the user data for the user corresponding to a given provider ID.
Parameters
providerId | Identifer for the given federated provider: for example, "google.com" for the Google provider. |
---|---|
uid | The user identifier with the given provider. |
Returns
- An
ApiFuture
which will complete successfully with aUserRecord
instance. If an error occurs while retrieving user data or if the provider ID and uid do not correspond to a user, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the uid is null or empty, or if the provider ID is null, empty, or does not belong to a federated provider. |
---|
public GetUsersResult getUsers (Collection<UserIdentifier> identifiers)
Gets the user data corresponding to the specified identifiers.
There are no ordering guarantees; in particular, the nth entry in the users result list is not guaranteed to correspond to the nth entry in the input parameters list.
A maximum of 100 identifiers may be specified. If more than 100 identifiers are
supplied, this method throws an IllegalArgumentException
.
Parameters
identifiers | The identifiers used to indicate which user records should be returned. Must have 100 or fewer entries. |
---|
Returns
- The corresponding user records.
Throws
IllegalArgumentException | If any of the identifiers are invalid or if more than 100 identifiers are specified. |
---|---|
NullPointerException | If the identifiers parameter is null. |
FirebaseAuthException | If an error occurs while retrieving user data. |
public ApiFuture<GetUsersResult> getUsersAsync (Collection<UserIdentifier> identifiers)
Gets the user data corresponding to the specified identifiers.
There are no ordering guarantees; in particular, the nth entry in the users result list is not guaranteed to correspond to the nth entry in the input parameters list.
A maximum of 100 identifiers may be specified. If more than 100 identifiers are
supplied, this method throws an IllegalArgumentException
.
Parameters
identifiers | The identifiers used to indicate which user records should be returned. Must have 100 or fewer entries. |
---|
Returns
- An
ApiFuture
that resolves to the corresponding user records.
Throws
IllegalArgumentException | If any of the identifiers are invalid or if more than 100 identifiers are specified. |
---|---|
NullPointerException | If the identifiers parameter is null. |
public UserImportResult importUsers (List<ImportUserRecord> users)
Imports the provided list of users into Firebase Auth. At most 1000 users can be imported at a time. This operation is optimized for bulk imports and will ignore checks on identifier uniqueness which could result in duplications.
UserImportOptions
is required to import users with passwords. See importUsers(List, UserImportOptions)
.
Parameters
users | A non-empty list of users to be imported. Length must not exceed 1000. |
---|
Returns
- A
UserImportResult
instance.
Throws
IllegalArgumentException | If the users list is null, empty or has more than 1000 elements. Or if at least one user specifies a password. |
---|---|
FirebaseAuthException | If an error occurs while importing users. |
public UserImportResult importUsers (List<ImportUserRecord> users, UserImportOptions options)
Imports the provided list of users into Firebase Auth. At most 1000 users can be imported at a time. This operation is optimized for bulk imports and will ignore checks on identifier uniqueness which could result in duplications.
Parameters
users | A non-empty list of users to be imported. Length must not exceed 1000. |
---|---|
options | a UserImportOptions instance or null. Required when importing users with
passwords. |
Returns
- A
UserImportResult
instance.
Throws
IllegalArgumentException | If the users list is null, empty or has more than 1000 elements. Or if at least one user specifies a password, and options is null. |
---|---|
FirebaseAuthException | If an error occurs while importing users. |
public ApiFuture<UserImportResult> importUsersAsync (List<ImportUserRecord> users)
Similar to importUsers(List)
but performs the operation asynchronously.
Parameters
users | A non-empty list of users to be imported. Length must not exceed 1000. |
---|
Returns
- An
ApiFuture
which will complete successfully when the user accounts are imported. If an error occurs while importing the users, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the users list is null, empty or has more than 1000 elements. Or if at least one user specifies a password. |
---|
public ApiFuture<UserImportResult> importUsersAsync (List<ImportUserRecord> users, UserImportOptions options)
Similar to importUsers(List, UserImportOptions)
but performs the operation
asynchronously.
Parameters
users | A non-empty list of users to be imported. Length must not exceed 1000. |
---|---|
options | a UserImportOptions instance or null. Required when importing users with
passwords. |
Returns
- An
ApiFuture
which will complete successfully when the user accounts are imported. If an error occurs while importing the users, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the users list is null, empty or has more than 1000 elements. Or if at least one user specifies a password, and options is null. |
---|
public ListProviderConfigsPage<OidcProviderConfig> listOidcProviderConfigs (String pageToken)
Gets a page of OpenID Connect auth provider configs starting from the specified
pageToken
. Page size is limited to 100 provider configs.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of provider configs. |
---|
Returns
- A
ListProviderConfigsPage
instance.
Throws
IllegalArgumentException | If the specified page token is empty |
---|---|
FirebaseAuthException | If an error occurs while retrieving provider config data. |
public ListProviderConfigsPage<OidcProviderConfig> listOidcProviderConfigs (String pageToken, int maxResults)
Gets a page of OpenID Connect auth provider configs starting from the specified
pageToken
.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of provider configs. |
---|---|
maxResults | Maximum number of provider configs to include in the returned page. This may not exceed 100. |
Returns
- A
ListProviderConfigsPage
instance.
Throws
IllegalArgumentException | If the specified page token is empty, or max results value is invalid. |
---|---|
FirebaseAuthException | If an error occurs while retrieving provider config data. |
public ApiFuture<ListProviderConfigsPage<OidcProviderConfig>> listOidcProviderConfigsAsync (String pageToken)
Similar to listOidcProviderConfigs(String)
but performs the operation asynchronously.
Page size is limited to 100 provider configs.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of provider configs. |
---|
Returns
- An
ApiFuture
which will complete successfully with aListProviderConfigsPage
instance. If an error occurs while retrieving provider config data, the future throws an exception.
Throws
IllegalArgumentException | If the specified page token is empty. |
---|
public ApiFuture<ListProviderConfigsPage<OidcProviderConfig>> listOidcProviderConfigsAsync (String pageToken, int maxResults)
Similar to listOidcProviderConfigs(String, int)
but performs the operation
asynchronously.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of provider configs. |
---|---|
maxResults | Maximum number of provider configs to include in the returned page. This may not exceed 100. |
Returns
- An
ApiFuture
which will complete successfully with aListProviderConfigsPage
instance. If an error occurs while retrieving provider config data, the future throws an exception.
Throws
IllegalArgumentException | If the specified page token is empty, or max results value is invalid. |
---|
public ListProviderConfigsPage<SamlProviderConfig> listSamlProviderConfigs (String pageToken)
Gets a page of SAML Auth provider configs starting from the specified pageToken
. Page
size is limited to 100 provider configs.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of provider configs. |
---|
Returns
- A
ListProviderConfigsPage
instance.
Throws
IllegalArgumentException | If the specified page token is empty. |
---|---|
FirebaseAuthException | If an error occurs while retrieving provider config data. |
public ListProviderConfigsPage<SamlProviderConfig> listSamlProviderConfigs (String pageToken, int maxResults)
Gets a page of SAML Auth provider configs starting from the specified pageToken
.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of provider configs. |
---|---|
maxResults | Maximum number of provider configs to include in the returned page. This may not exceed 100. |
Returns
- A
ListProviderConfigsPage
instance.
Throws
IllegalArgumentException | If the specified page token is empty, or max results value is invalid. |
---|---|
FirebaseAuthException | If an error occurs while retrieving provider config data. |
public ApiFuture<ListProviderConfigsPage<SamlProviderConfig>> listSamlProviderConfigsAsync (String pageToken)
Similar to listSamlProviderConfigs(String)
but performs the operation asynchronously.
Page size is limited to 100 provider configs.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of provider configs. |
---|
Returns
- An
ApiFuture
which will complete successfully with aListProviderConfigsPage
instance. If an error occurs while retrieving provider config data, the future throws an exception.
Throws
IllegalArgumentException | If the specified page token is empty. |
---|
public ApiFuture<ListProviderConfigsPage<SamlProviderConfig>> listSamlProviderConfigsAsync (String pageToken, int maxResults)
Similar to listSamlProviderConfigs(String, int)
but performs the operation
asynchronously.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of provider configs. |
---|---|
maxResults | Maximum number of provider configs to include in the returned page. This may not exceed 100. |
Returns
- An
ApiFuture
which will complete successfully with aListProviderConfigsPage
instance. If an error occurs while retrieving provider config data, the future throws an exception.
Throws
IllegalArgumentException | If the specified page token is empty, or max results value is invalid. |
---|
public ListUsersPage listUsers (String pageToken, int maxResults)
Gets a page of users starting from the specified pageToken
.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of users. |
---|---|
maxResults | Maximum number of users to include in the returned page. This may not exceed 1000. |
Returns
- A
ListUsersPage
instance.
Throws
IllegalArgumentException | If the specified page token is empty, or max results value is invalid. |
---|---|
FirebaseAuthException | If an error occurs while retrieving user data. |
public ListUsersPage listUsers (String pageToken)
Gets a page of users starting from the specified pageToken
. Page size is limited to
1000 users.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of users. |
---|
Returns
- A
ListUsersPage
instance.
Throws
IllegalArgumentException | If the specified page token is empty. |
---|---|
FirebaseAuthException | If an error occurs while retrieving user data. |
public ApiFuture<ListUsersPage> listUsersAsync (String pageToken, int maxResults)
Similar to listUsers(String, int)
but performs the operation asynchronously.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of users. |
---|---|
maxResults | Maximum number of users to include in the returned page. This may not exceed 1000. |
Returns
- An
ApiFuture
which will complete successfully with aListUsersPage
instance. If an error occurs while retrieving user data, the future throws an exception.
Throws
IllegalArgumentException | If the specified page token is empty, or max results value is invalid. |
---|
public ApiFuture<ListUsersPage> listUsersAsync (String pageToken)
Similar to listUsers(String)
but performs the operation asynchronously.
Parameters
pageToken | A non-empty page token string, or null to retrieve the first page of users. |
---|
Returns
- An
ApiFuture
which will complete successfully with aListUsersPage
instance. If an error occurs while retrieving user data, the future throws an exception.
Throws
IllegalArgumentException | If the specified page token is empty. |
---|
public void revokeRefreshTokens (String uid)
Revokes all refresh tokens for the specified user.
Updates the user's tokensValidAfterTimestamp to the current UTC time expressed in milliseconds since the epoch and truncated to 1 second accuracy. It is important that the server on which this is called has its clock set correctly and synchronized.
While this will revoke all sessions for a specified user and disable any new ID tokens for
existing sessions from getting minted, existing ID tokens may remain active until their natural
expiration (one hour). To verify that ID tokens are revoked, use verifyIdTokenAsync(String, boolean)
.
Parameters
uid | The user id for which tokens are revoked. |
---|
Throws
IllegalArgumentException | If the user ID is null or empty. |
---|---|
FirebaseAuthException | If an error occurs while revoking tokens. |
public ApiFuture<Void> revokeRefreshTokensAsync (String uid)
Similar to revokeRefreshTokens(String)
but performs the operation asynchronously.
Parameters
uid | The user id for which tokens are revoked. |
---|
Returns
- An
ApiFuture
which will complete successfully or fail with aFirebaseAuthException
in the event of an error.
Throws
IllegalArgumentException | If the user ID is null or empty. |
---|
public void setCustomClaims (String uid, Map<String, Object> claims)
This method is deprecated.
Use setCustomUserClaims(String, Map)
instead.
Throws
FirebaseAuthException |
---|
public void setCustomUserClaims (String uid, Map<String, Object> claims)
Sets the specified custom claims on an existing user account. A null claims value removes any claims currently set on the user account. The claims should serialize into a valid JSON string. The serialized claims must not be larger than 1000 characters.
Parameters
uid | A user ID string. |
---|---|
claims | A map of custom claims or null. |
Throws
FirebaseAuthException | If an error occurs while updating custom claims. |
---|---|
IllegalArgumentException | If the user ID string is null or empty, or the claims payload is invalid or too large. |
public ApiFuture<Void> setCustomUserClaimsAsync (String uid, Map<String, Object> claims)
Similar to setCustomUserClaims(String, Map)
but performs the operation asynchronously.
Parameters
uid | A user ID string. |
---|---|
claims | A map of custom claims or null. |
Returns
- An
ApiFuture
which will complete successfully when the user account has been updated. If an error occurs while deleting the user account, the future throws aFirebaseAuthException
.
Throws
IllegalArgumentException | If the user ID string is null or empty. |
---|
public OidcProviderConfig updateOidcProviderConfig (OidcProviderConfig.UpdateRequest request)
Updates an existing OpenID Connect auth provider config with the attributes contained in the
specified OidcProviderConfig.UpdateRequest
.
Parameters
request | A non-null OidcProviderConfig.UpdateRequest instance. |
---|
Returns
- A
OidcProviderConfig
instance corresponding to the updated provider config.
Throws
NullPointerException | if the provided update request is null. |
---|---|
IllegalArgumentException | If the provided update request is invalid. |
FirebaseAuthException | if an error occurs while updating the provider config. |
public ApiFuture<OidcProviderConfig> updateOidcProviderConfigAsync (OidcProviderConfig.UpdateRequest request)
Similar to updateOidcProviderConfig(OidcProviderConfig.UpdateRequest)
but performs the operation asynchronously.
Parameters
request | A non-null OidcProviderConfig.UpdateRequest instance. |
---|
Returns
- An
ApiFuture
which will complete successfully with aOidcProviderConfig
instance corresponding to the updated provider config. If an error occurs while updating the provider config, the future throws aFirebaseAuthException
.
Throws
NullPointerException | if the provided update request is null. |
---|---|
IllegalArgumentException | If the provided update request is invalid. |
public SamlProviderConfig updateSamlProviderConfig (SamlProviderConfig.UpdateRequest request)
Updates an existing SAML Auth provider config with the attributes contained in the specified
SamlProviderConfig.UpdateRequest
.
Parameters
request | A non-null SamlProviderConfig.UpdateRequest instance. |
---|
Returns
- A
SamlProviderConfig
instance corresponding to the updated provider config.
Throws
NullPointerException | if the provided update request is null. |
---|---|
IllegalArgumentException | If the provided update request is invalid. |
FirebaseAuthException | if an error occurs while updating the provider config. |
public ApiFuture<SamlProviderConfig> updateSamlProviderConfigAsync (SamlProviderConfig.UpdateRequest request)
Similar to updateSamlProviderConfig(SamlProviderConfig.UpdateRequest)
but performs the operation asynchronously.
Parameters
request | A non-null SamlProviderConfig.UpdateRequest instance. |
---|
Returns
- An
ApiFuture
which will complete successfully with aSamlProviderConfig
instance corresponding to the updated provider config. If an error occurs while updating the provider config, the future throws aFirebaseAuthException
.
Throws
NullPointerException | if the provided update request is null. |
---|---|
IllegalArgumentException | If the provided update request is invalid. |
public UserRecord updateUser (UserRecord.UpdateRequest request)
Updates an existing user account with the attributes contained in the specified UserRecord.UpdateRequest
.
Parameters
request | A non-null UserRecord.UpdateRequest instance. |
---|
Returns
- A
UserRecord
instance corresponding to the updated user account.
Throws
NullPointerException | if the provided update request is null. |
---|---|
FirebaseAuthException | if an error occurs while updating the user account. |
public ApiFuture<UserRecord> updateUserAsync (UserRecord.UpdateRequest request)
Similar to updateUser(UserRecord.UpdateRequest)
but performs the operation asynchronously.
Parameters
request | A non-null UserRecord.UpdateRequest instance. |
---|
Returns
- An
ApiFuture
which will complete successfully with aUserRecord
instance corresponding to the updated user account. If an error occurs while updating the user account, the future throws aFirebaseAuthException
.
public FirebaseToken verifyIdToken (String idToken, boolean checkRevoked)
Parses and verifies a Firebase ID Token.
A Firebase application can identify itself to a trusted backend server by sending its
Firebase ID Token (accessible via the getToken
API in the Firebase Authentication
client) with its requests. The backend server can then use the verifyIdToken()
method
to verify that the token is valid. This method ensures that the token is correctly signed, has
not expired, and it was issued to the Firebase project associated with this FirebaseAuth
instance.
If checkRevoked
is set to true, this method performs an additional check to see if
the ID token has been revoked since it was issues. This requires making an additional remote
API call.
Parameters
idToken | A Firebase ID token string to parse and verify. |
---|---|
checkRevoked | A boolean denoting whether to check if the tokens were revoked or if the user is disabled. |
Returns
- A
FirebaseToken
representing the verified and decoded token.
Throws
IllegalArgumentException | If the token is null, empty, or if the FirebaseApp
instance does not have a project ID associated with it. |
---|---|
FirebaseAuthException | If an error occurs while parsing or validating the token, or if the user is disabled. |
public FirebaseToken verifyIdToken (String idToken)
Parses and verifies a Firebase ID Token.
A Firebase application can identify itself to a trusted backend server by sending its
Firebase ID Token (accessible via the getToken
API in the Firebase Authentication
client) with its requests. The backend server can then use the verifyIdToken()
method
to verify that the token is valid. This method ensures that the token is correctly signed, has
not expired, and it was issued to the Firebase project associated with this FirebaseAuth
instance.
This method does not check whether a token has been revoked. Use verifyIdToken(String, boolean)
to perform an additional revocation check.
Parameters
idToken | A Firebase ID token string to parse and verify. |
---|
Returns
- A
FirebaseToken
representing the verified and decoded token.
Throws
IllegalArgumentException | If the token is null, empty, or if the FirebaseApp
instance does not have a project ID associated with it. |
---|---|
FirebaseAuthException | If an error occurs while parsing or validating the token. |
public ApiFuture<FirebaseToken> verifyIdTokenAsync (String idToken)
Similar to verifyIdToken(String)
but performs the operation asynchronously.
Parameters
idToken | A Firebase ID Token to verify and parse. |
---|
Returns
- An
ApiFuture
which will complete successfully with the parsed token, or unsuccessfully with aFirebaseAuthException
.
Throws
IllegalArgumentException | If the token is null, empty, or if the FirebaseApp
instance does not have a project ID associated with it.
|
---|
public ApiFuture<FirebaseToken> verifyIdTokenAsync (String idToken, boolean checkRevoked)
Similar to verifyIdToken(String, boolean)
but performs the operation asynchronously.
Parameters
idToken | A Firebase ID Token to verify and parse. |
---|---|
checkRevoked | A boolean denoting whether to check if the tokens were revoked. |
Returns
- An
ApiFuture
which will complete successfully with the parsed token, or unsuccessfully with aFirebaseAuthException
.
Throws
IllegalArgumentException | If the token is null, empty, or if the FirebaseApp
instance does not have a project ID associated with it.
|
---|
public FirebaseToken verifySessionCookie (String cookie, boolean checkRevoked)
Parses and verifies a Firebase session cookie.
If checkRevoked
is true, additionally verifies that the cookie has not been revoked.
If verified successfully, returns a parsed version of the cookie from which the UID and the
other claims can be read. If the cookie is invalid or has been revoked while checkRevoked
is true, throws a FirebaseAuthException
.
Parameters
cookie | A Firebase session cookie string to verify and parse. |
---|---|
checkRevoked | A boolean indicating whether to check if the cookie was explicitly revoked or if the user is disabled. |
Returns
- A
FirebaseToken
representing the verified and decoded cookie.
Throws
FirebaseAuthException | If an error occurs while parsing or validating the token, or if the user is disabled. |
---|
public FirebaseToken verifySessionCookie (String cookie)
Parses and verifies a Firebase session cookie.
If verified successfully, returns a parsed version of the cookie from which the UID and the
other claims can be read. If the cookie is invalid, throws a FirebaseAuthException
.
This method does not check whether the cookie has been revoked. See verifySessionCookie(String, boolean)
.
Parameters
cookie | A Firebase session cookie string to verify and parse. |
---|
Returns
- A
FirebaseToken
representing the verified and decoded cookie.
Throws
FirebaseAuthException |
---|
public ApiFuture<FirebaseToken> verifySessionCookieAsync (String cookie, boolean checkRevoked)
Similar to verifySessionCookie(String, boolean)
but performs the operation
asynchronously.
Parameters
cookie | A Firebase session cookie string to verify and parse. |
---|---|
checkRevoked | A boolean indicating whether to check if the cookie was explicitly revoked. |
Returns
- An
ApiFuture
which will complete successfully with the parsed cookie, or unsuccessfully with the failure Exception.
public ApiFuture<FirebaseToken> verifySessionCookieAsync (String cookie)
Similar to verifySessionCookie(String)
but performs the operation asynchronously.
Parameters
cookie | A Firebase session cookie string to verify and parse. |
---|
Returns
- An
ApiFuture
which will complete successfully with the parsed cookie, or unsuccessfully with the failure Exception.