FIRUser


@interface FIRUser : NSObject <FIRUserInfo>

Represents a user. Firebase Auth does not attempt to validate users when loading them from the keychain. Invalidated users (such as those whose passwords have been changed on another client) are automatically logged out when an auth-dependent operation is attempted or when the ID token is automatically refreshed. This class is thread-safe.

  • Indicates the user represents an anonymous user.

    Declaration

    Objective-C

    @property (readonly, getter=isAnonymous, nonatomic) BOOL anonymous;
  • Indicates the email address associated with this user has been verified.

    Declaration

    Objective-C

    @property (readonly, getter=isEmailVerified, nonatomic) BOOL emailVerified;
  • A refresh token; useful for obtaining new access tokens independently. This property should only be used for advanced scenarios, and is not typically needed.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSString *refreshToken;
  • Profile data for each identity provider, if any. This data is cached on sign-in and updated when linking or unlinking.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nonnull) NSArray<id<FIRUserInfo>> *providerData;
  • Metadata associated with the Firebase user in question.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nonnull) FIRUserMetadata *metadata;
  • This class should not be instantiated. To retrieve the current user, use FIRAuth.currentUser. To sign a user in or out, use the methods on FIRAuth.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Updates the email address for the user. On success, the cached user profile data is updated. May fail if there is already an account with this email address that was created using email and password authentication.

    Possible error codes:

    + `FIRAuthErrorCodeInvalidRecipientEmail` - Indicates an invalid recipient email was
        sent in the request.
    + `FIRAuthErrorCodeInvalidSender` - Indicates an invalid sender email is set in
        the console for this action.
    + `FIRAuthErrorCodeInvalidMessagePayload` - Indicates an invalid email template for
        sending update email.
    + `FIRAuthErrorCodeEmailAlreadyInUse` - Indicates the email is already in use by another
        account.
    + `FIRAuthErrorCodeInvalidEmail` - Indicates the email address is malformed.
    + `FIRAuthErrorCodeRequiresRecentLogin` - Updating a users email is a security
        sensitive operation that requires a recent login from the user. This error indicates
        the user has not signed in recently enough. To resolve, reauthenticate the user by
        invoking reauthenticateWithCredential:completion: on FIRUser.
    

    See FIRAuthErrors for a list of error codes that are common to all FIRUser methods.

    Declaration

    Objective-C

    - (void)updateEmail:(nonnull NSString *)email
             completion:(nullable FIRUserProfileChangeCallback)completion;

    Parameters

    email

    The email address for the user.

    completion

    Optionally; the block invoked when the user profile change has finished. Invoked asynchronously on the main thread in the future.

  • Updates the password for the user. On success, the cached user profile data is updated.

    Possible error codes:

    + `FIRAuthErrorCodeOperationNotAllowed` - Indicates the administrator disabled
        sign in with the specified identity provider.
    + `FIRAuthErrorCodeRequiresRecentLogin` - Updating a users password is a security
        sensitive operation that requires a recent login from the user. This error indicates
        the user has not signed in recently enough. To resolve, reauthenticate the user by
        invoking reauthenticateWithCredential:completion: on FIRUser.
    + `FIRAuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is
        considered too weak. The NSLocalizedFailureReasonErrorKey field in the NSError.userInfo
        dictionary object will contain more detailed explanation that can be shown to the user.
    

    See FIRAuthErrors for a list of error codes that are common to all FIRUser methods.

    Declaration

    Objective-C

    - (void)updatePassword:(nonnull NSString *)password
                completion:(nullable FIRUserProfileChangeCallback)completion;

    Parameters

    password

    The new password for the user.

    completion

    Optionally; the block invoked when the user profile change has finished. Invoked asynchronously on the main thread in the future.

  • Updates the phone number for the user. On success, the cached user profile data is updated.

    Possible error codes:

    + `FIRAuthErrorCodeRequiresRecentLogin` - Updating a users phone number is a security
        sensitive operation that requires a recent login from the user. This error indicates
        the user has not signed in recently enough. To resolve, reauthenticate the user by
        invoking reauthenticateWithCredential:completion: on FIRUser.
    

    See