LuxChat  2.0
Instant messenger for iOS
Instance Methods | Properties | List of all members
FIRUser Class Reference

Represents a user. More...

#import <FIRUser.h>

Inheritance diagram for FIRUser:
<FIRUserInfo>

Instance Methods

(nullable instancetype) - NS_UNAVAILABLE
 
(void) - updateEmail:completion:
 Updates the email address for the user. On success, the cached user profile data is updated. More...
 
(void) - updatePassword:completion:
 Updates the password for the user. On success, the cached user profile data is updated. More...
 
(FIRUserProfileChangeRequest *) - profileChangeRequest
 Creates an object which may be used to change the user's profile data. More...
 
(void) - reloadWithCompletion:
 Reloads the user's profile data from the server. More...
 
(void) - reauthenticateWithCredential:completion:
 Renews the user's authentication tokens by validating a fresh set of credentials supplied by the user. More...
 
(void) - getTokenWithCompletion:
 Retrieves the Firebase authentication token, possibly refreshing it if it has expired. More...
 
(void) - getTokenForcingRefresh:completion:
 Retrieves the Firebase authentication token, possibly refreshing it if it has expired. More...
 
(void) - linkWithCredential:completion:
 Associates a user account from a third-party identity provider with this user. More...
 
(void) - unlinkFromProvider:completion:
 Disassociates a user account from a third-party identity provider with this user. More...
 
(void) - sendEmailVerificationWithCompletion:
 Initiates email verification for the user. More...
 
(void) - deleteWithCompletion:
 Deletes the user account (also signs out the user, if this was the current user). More...
 

Properties

BOOL anonymous
 Indicates the user represents an anonymous user.
 
BOOL emailVerified
 Indicates the email address associated with this user has been verified.
 
NSString * refreshToken
 A refresh token; useful for obtaining new access tokens independently. More...
 
NSArray< id< FIRUserInfo > > * providerData
 Profile data for each identity provider, if any. More...
 

Detailed Description

Represents a user.

Remarks
This class is thread-safe.

Method Documentation

- deleteWithCompletion: (nullable FIRUserProfileChangeCallback completion

Deletes the user account (also signs out the user, if this was the current user).

Parameters
completionOptionally; the block invoked when the request to delete the account is complete, or fails. Invoked asynchronously on the main thread in the future.
Remarks
Possible error codes:
  • FIRAuthErrorCodeRequiresRecentLogin - Updating 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 operations.
- getTokenForcingRefresh: (BOOL)  forceRefresh
completion: (nullable FIRAuthTokenCallback)  completion 

Retrieves the Firebase authentication token, possibly refreshing it if it has expired.

Parameters
forceRefreshForces a token refresh. Useful if the token becomes invalid for some reason other than an expiration.
completionOptionally; the block invoked when the token is available. Invoked asynchronously on the main thread in the future.
Remarks
The authentication token will be refreshed (by making a network request) if it has expired, or if forceRefresh is YES.
Possible error codes:
  • See FIRAuthErrors for a list of error codes that are common to all API methods.
- getTokenWithCompletion: (nullable FIRAuthTokenCallback)  completion

Retrieves the Firebase authentication token, possibly refreshing it if it has expired.

Parameters
completionOptionally; the block invoked when the token is available. Invoked asynchronously on the main thread in the future.
Remarks
Possible error codes:
  • See FIRAuthErrors for a list of error codes that are common to all API methods.
- linkWithCredential: (FIRAuthCredential *)  credential
completion: (nullable FIRAuthResultCallback completion 

Associates a user account from a third-party identity provider with this user.

Parameters
credentialThe credential for the identity provider.
completionOptionally; the block invoked when the unlinking is complete, or fails. Invoked asynchronously on the main thread in the future.
Remarks
Possible error codes:
  • FIRAuthErrorCodeProviderAlreadyLinked - Indicates an attempt to link a provider of a type already linked to this account.
  • FIRAuthErrorCodeCredentialAlreadyInUse - Indicates an attempt to link with a credential that has already been linked with a different Firebase account.
  • FIRAuthErrorCodeOperationNotAllowed - Indicates that accounts with the identity provider represented by the credential are not enabled. Enable them in the Auth section of the Firebase console.
  • This method may also return error codes associated with updateEmail:completion: and updatePassword:completion: on FIRUser.
  • See FIRAuthErrors for a list of error codes that are common to all FIRUser operations.
- profileChangeRequest

Creates an object which may be used to change the user's profile data.

Remarks
Set the properties of the returned object, then call FIRUserProfileChangeRequest.commitChangesWithCallback: to perform the updates atomically.
Returns
An object which may be used to change the user's profile data atomically.
- reauthenticateWithCredential: (FIRAuthCredential *)  credential
completion: (nullable FIRUserProfileChangeCallback completion 

Renews the user's authentication tokens by validating a fresh set of credentials supplied by the user.

Parameters
credentialA user-supplied credential, which will be validated by the server. This can be a successful third-party identity provider sign-in, or an email address and password.
completionOptionally; the block invoked when the re-authentication operation has finished. Invoked asynchronously on the main thread in the future.
Remarks
If the user associated with the supplied credential is different from the current user, or if the validation of the supplied credentials fails; an error is returned and the current user remains signed in.
Possible error codes:
  • FIRAuthErrorCodeInvalidCredential Indicates the supplied credential is invalid. This could happen if it has expired or it is malformed.
  • FIRAuthErrorCodeOperationNotAllowed Indicates that accounts with the identity provider represented by the credential are not enabled. Enable them in the Auth section of the Firebase console.
  • FIRAuthErrorCodeEmailAlreadyInUse Indicates the email asserted by the credential (e.g. the email in a Facebook access token) is already in use by an existing account, that cannot be authenticated with this method. Call fetchProvidersForEmail for this user’s email and then prompt them to sign in with any of the sign-in providers returned. This error will only be thrown if the “One account per email address” setting is enabled in the Firebase console, under Auth settings. - Please note that the error code raised in this specific situation may not be the same on Web and Android.
  • FIRAuthErrorCodeUserDisabled Indicates the user's account is disabled.
  • FIRAuthErrorCodeWrongPassword Indicates the user attempted reauthentication with an incorrect password, if credential is of the type EmailPasswordAuthCredential.
  • FIRAuthErrorCodeUserMismatch Indicates that an attempt was made to reauthenticate with a user which is not the current user.
  • See FIRAuthErrors for a list of error codes that are common to all API methods.
- reloadWithCompletion: (nullable FIRUserProfileChangeCallback completion

Reloads the user's profile data from the server.

Parameters
completionOptionally; the block invoked when the reload has finished. Invoked asynchronously on the main thread in the future.
Remarks
May fail with a FIRAuthErrorCodeCredentialTooOld error code. In this case you should call reauthenticateWithCredential:completion: before re-invoking updateEmail:completion:.
Possible error codes:
  • See FIRAuthErrors for a list of error codes that are common to all API methods.
- sendEmailVerificationWithCompletion: (nullable FIRSendEmailVerificationCallback completion

Initiates email verification for the user.

Parameters
completionOptionally; the block invoked when the request to send an email verification is complete, or fails. Invoked asynchronously on the main thread in the future.
Remarks
Possible error codes:
  • FIRAuthErrorCodeUserNotFound - Indicates the user account was not found.
  • See FIRAuthErrors for a list of error codes that are common to all FIRUser operations.
- unlinkFromProvider: (NSString *)  provider
completion: (nullable FIRAuthResultCallback completion 

Disassociates a user account from a third-party identity provider with this user.

Parameters
providerThe provider ID of the provider to unlink.
completionOptionally; the block invoked when the unlinking is complete, or fails. Invoked asynchronously on the main thread in the future.
Remarks
Possible error codes:
  • FIRAuthErrorCodeNoSuchProvider - Indicates an attempt to unlink a provider that is not linked to the account.
  • FIRAuthErrorCodeRequiresRecentLogin - Updating 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 operations.
- updateEmail: (NSString *)  email
completion: (nullable FIRUserProfileChangeCallback completion 

Updates the email address for the user. On success, the cached user profile data is updated.

Remarks
May fail if there is already an account with this email address that was created using email and password authentication.
Parameters
emailThe email address for the user.
completionOptionally; the block invoked when the user profile change has finished. Invoked asynchronously on the main thread in the future.
Remarks
Possible error codes:
  • FIRAuthErrorCodeEmailAlreadyInUse - Indicates the email is already in use by another account.
  • FIRAuthErrorCodeInvalidEmail - Indicates the email address is malformed.
  • FIRAuthErrorCodeRequiresRecentLogin - Updating a user’s 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 operations.
- updatePassword: (NSString *)  password
completion: (nullable FIRUserProfileChangeCallback completion 

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

Parameters
passwordThe new password for the user.
completionOptionally; the block invoked when the user profile change has finished. Invoked asynchronously on the main thread in the future.
Remarks
Possible error codes:
  • FIRAuthErrorCodeOperationNotAllowed - Indicates the administrator disabled sign in with the specified identity provider.
  • FIRAuthErrorCodeRequiresRecentLogin - Updating a user’s 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 operations.

Property Documentation

- providerData
readnonatomicassign

Profile data for each identity provider, if any.

Remarks
This data is cached on sign-in and updated when linking or unlinking.
- refreshToken
readnonatomicassign

A refresh token; useful for obtaining new access tokens independently.

Remarks
This property should only be used for advanced scenarios, and is not typically needed.

The documentation for this class was generated from the following file: