A class for updating the attributes of an existing user. An instance of this class can be
obtained via a UserRecord
object, or from a user ID string. Specify the changes to be
made in the user account by calling the various setter methods available in this class.
Public Constructor Summary
UpdateRequest(String uid)
Creates a new
UserRecord.UpdateRequest , which can be used to update the attributes
of the user identified by the specified user ID. |
Public Method Summary
UserRecord.UpdateRequest |
setCustomClaims(Map<String, Object> customClaims)
Updates the custom claims associated with this user.
|
UserRecord.UpdateRequest |
setDisabled(boolean disabled)
Enables or disables this user account.
|
UserRecord.UpdateRequest |
setDisplayName(String displayName)
Updates the display name of this user.
|
UserRecord.UpdateRequest |
setEmail(String email)
Updates the email address associated with this user.
|
UserRecord.UpdateRequest |
setEmailVerified(boolean emailVerified)
Updates the email verification status of this account.
|
UserRecord.UpdateRequest |
setPassword(String password)
Updates the password of this user.
|
UserRecord.UpdateRequest |
setPhoneNumber(String phone)
Updates the phone number associated with this user.
|
UserRecord.UpdateRequest |
setPhotoUrl(String photoUrl)
Updates the Photo URL of this user.
|
UserRecord.UpdateRequest | |
UserRecord.UpdateRequest |
setProvidersToUnlink(Iterable<String> providerIds)
Unlinks this user from the specified providers.
|
Inherited Method Summary
Public Constructors
public UpdateRequest (String uid)
Creates a new UserRecord.UpdateRequest
, which can be used to update the attributes
of the user identified by the specified user ID. This method allows updating attributes of
a user account, without first having to call getUser(String)
.
Parameters
uid | a non-null, non-empty user ID string. |
---|
Throws
IllegalArgumentException | If the user ID is null or empty. |
---|
Public Methods
public UserRecord.UpdateRequest setCustomClaims (Map<String, Object> customClaims)
Updates the custom claims associated with this user. Calling this method with a null argument removes any custom claims from the user account.
Parameters
customClaims | a Map of custom claims or null |
---|
public UserRecord.UpdateRequest setDisabled (boolean disabled)
Enables or disables this user account.
Parameters
disabled | a boolean indicating whether this account should be disabled. |
---|
public UserRecord.UpdateRequest setDisplayName (String displayName)
Updates the display name of this user. Calling this method with a null argument removes the display name attribute from the user account.
Parameters
displayName | a display name string or null |
---|
public UserRecord.UpdateRequest setEmail (String email)
Updates the email address associated with this user.
Parameters
a non-null, non-empty email address to be associated with the user. |
public UserRecord.UpdateRequest setEmailVerified (boolean emailVerified)
Updates the email verification status of this account.
Parameters
emailVerified | a boolean indicating whether the email address has been verified. |
---|
public UserRecord.UpdateRequest setPassword (String password)
Updates the password of this user.
Parameters
password | a new password string that is at least 6 characters long. |
---|
public UserRecord.UpdateRequest setPhoneNumber (String phone)
Updates the phone number associated with this user. Calling this method with a null argument removes the phone number from the user account.
Parameters
phone | a valid phone number string or null. |
---|
public UserRecord.UpdateRequest setPhotoUrl (String photoUrl)
Updates the Photo URL of this user. Calling this method with a null argument removes the photo URL attribute from the user account.
Parameters
photoUrl | a valid URL string or null |
---|
public UserRecord.UpdateRequest setProviderToLink (UserProvider providerToLink)
Links this user to the specified provider.
Linking a provider to an existing user account does not invalidate the refresh token of that account. In other words, the existing account continues to be able to access resources, despite not having used the newly linked provider to sign in. If you wish to force the user to authenticate with this new provider, you need to (a) revoke their refresh token (see https://firebase.google.com/docs/auth/admin/manage-sessions#revoke_refresh_tokens), and (b) ensure no other authentication methods are present on this account.
Parameters
providerToLink | provider info to be linked to this user\'s account. |
---|
public UserRecord.UpdateRequest setProvidersToUnlink (Iterable<String> providerIds)
Unlinks this user from the specified providers.
Parameters
providerIds | list of identifiers for the identity providers. |
---|