diff options
Diffstat (limited to 'Firebase/Auth/Source/Public/FIRAuth.h')
-rw-r--r-- | Firebase/Auth/Source/Public/FIRAuth.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/Firebase/Auth/Source/Public/FIRAuth.h b/Firebase/Auth/Source/Public/FIRAuth.h index f18a3d0..c985658 100644 --- a/Firebase/Auth/Source/Public/FIRAuth.h +++ b/Firebase/Auth/Source/Public/FIRAuth.h @@ -114,6 +114,14 @@ typedef void (^FIRProviderQueryCallback)(NSArray<NSString *> *_Nullable provider NSError *_Nullable error) NS_SWIFT_NAME(ProviderQueryCallback); +/** @typedef FIRSignInMethodQueryCallback + @brief The type of block invoked when a list of sign-in methods for a given email address is + requested. + */ +typedef void (^FIRSignInMethodQueryCallback)(NSArray<NSString *> *_Nullable, + NSError *_Nullable) + NS_SWIFT_NAME(SignInMethodQueryCallback); + /** @typedef FIRSendPasswordResetCallback @brief The type of block invoked when sending a password reset email. @@ -123,6 +131,12 @@ typedef void (^FIRProviderQueryCallback)(NSArray<NSString *> *_Nullable provider typedef void (^FIRSendPasswordResetCallback)(NSError *_Nullable error) NS_SWIFT_NAME(SendPasswordResetCallback); +/** @typedef FIRSendSignInLinkToEmailCallback + @brief The type of block invoked when sending an email sign-in link email. + */ +typedef void (^FIRSendSignInLinkToEmailCallback)(NSError *_Nullable error) + NS_SWIFT_NAME(SendSignInLinkToEmailCallback); + /** @typedef FIRConfirmPasswordResetCallback @brief The type of block invoked when performing a password reset. @@ -190,6 +204,10 @@ typedef NS_ENUM(NSInteger, FIRActionCodeOperation) { /** Action code for recover email operation. */ FIRActionCodeOperationRecoverEmail = 3, + /** Action code for email link operation. */ + FIRActionCodeOperationEmailLink = 4, + + } NS_SWIFT_NAME(ActionCodeOperation); /** @@ -297,6 +315,24 @@ NS_SWIFT_NAME(Auth) - (void)fetchProvidersForEmail:(NSString *)email completion:(nullable FIRProviderQueryCallback)completion; +/** @fn fetchSignInMethodsForEmail:completion: + @brief Fetches the list of all sign-in methods previously used for the provided email address. + + @param email The email address for which to obtain a list of sign-in methods. + @param completion Optionally; a block which is invoked when the list of sign in methods for the + specified email address is ready or an error was encountered. Invoked asynchronously on the + main thread in the future. + + @remarks Possible error codes: + + + `FIRAuthErrorCodeInvalidEmail` - Indicates the email address is malformed. + + @remarks See @c FIRAuthErrors for a list of error codes that are common to all API methods. + */ + +- (void)fetchSignInMethodsForEmail:(NSString *)email + completion:(nullable FIRSignInMethodQueryCallback)completion; + /** @fn signInWithEmail:password:completion: @brief Signs in using an email address and password. @@ -322,6 +358,30 @@ NS_SWIFT_NAME(Auth) password:(NSString *)password completion:(nullable FIRAuthResultCallback)completion; +/** @fn signInWithEmail:link:completion: + @brief Signs in using an email address and email sign-in link. + + @param email The user's email address. + @param link The email sign-in link. + @param completion Optionally; a block which is invoked when the sign in flow finishes, or is + canceled. Invoked asynchronously on the main thread in the future. + + @remarks Possible error codes: + + + `FIRAuthErrorCodeOperationNotAllowed` - Indicates that email and email sign-in link + accounts are not enabled. Enable them in the Auth section of the + Firebase console. + + `FIRAuthErrorCodeUserDisabled` - Indicates the user's account is disabled. + + `FIRAuthErrorCodeInvalidEmail` - Indicates the email address is invalid. + + + @remarks See `FIRAuthErrors` for a list of error codes that are common to all API methods. + */ + +- (void)signInWithEmail:(NSString *)email + link:(NSString *)link + completion:(nullable FIRAuthDataResultCallback)completion; + /** @fn signInAndRetrieveDataWithEmail:password:completion: @brief Signs in using an email address and password. @@ -654,6 +714,19 @@ NS_SWIFT_NAME(Auth) actionCodeSettings:(FIRActionCodeSettings *)actionCodeSettings completion:(nullable FIRSendPasswordResetCallback)completion; +/** @fn sendSignInLinkToEmail:actionCodeSettings:completion: + @brief Sends a sign in with email link to provided email address. + + @param email The email address of the user. + @param actionCodeSettings An @c FIRActionCodeSettings object containing settings related to + handling action codes. + @param completion Optionally; a block which is invoked when the request finishes. Invoked + asynchronously on the main thread in the future. + */ +- (void)sendSignInLinkToEmail:(NSString *)email + actionCodeSettings:(FIRActionCodeSettings *)actionCodeSettings + completion:(nullable FIRSendSignInLinkToEmailCallback)completion; + /** @fn signOut: @brief Signs out the current user. @@ -672,6 +745,14 @@ NS_SWIFT_NAME(Auth) */ - (BOOL)signOut:(NSError *_Nullable *_Nullable)error; +/** @fn isSignInWithEmailLink + @brief Checks if link is an email sign-in link. + + @param link The email sign-in link. + @return @YES when the link passed matches the expected format of an email sign-in link. + */ +- (BOOL)isSignInWithEmailLink:(NSString *)link; + /** @fn addAuthStateDidChangeListener: @brief Registers a block as an "auth state did change" listener. To be invoked when: |