diff options
Diffstat (limited to 'Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m')
-rw-r--r-- | Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m b/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m index 653eddd..438f24b 100644 --- a/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m +++ b/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m @@ -79,6 +79,11 @@ static NSString *const kCanHandleCodeInAppKey = @"canHandleCodeInApp"; */ static NSString *const kPasswordResetRequestTypeValue = @"PASSWORD_RESET"; +/** @var kEmailLinkSignInTypeValue + @brief The value for the "EMAIL_SIGNIN" request type. + */ +static NSString *const kEmailLinkSignInTypeValue= @"EMAIL_SIGNIN"; + /** @var kVerifyEmailRequestTypeValue @brief The value for the "VERIFY_EMAIL" request type. */ @@ -116,6 +121,8 @@ static NSString *const kVerifyEmailRequestTypeValue = @"VERIFY_EMAIL"; return kPasswordResetRequestTypeValue; case FIRGetOOBConfirmationCodeRequestTypeVerifyEmail: return kVerifyEmailRequestTypeValue; + case FIRGetOOBConfirmationCodeRequestTypeEmailLink: + return kEmailLinkSignInTypeValue; // No default case so that we get a compiler warning if a new value was added to the enum. } } @@ -142,6 +149,17 @@ static NSString *const kVerifyEmailRequestTypeValue = @"VERIFY_EMAIL"; requestConfiguration:requestConfiguration]; } ++ (FIRGetOOBConfirmationCodeRequest *) + signInWithEmailLinkRequest:(NSString *)email + actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings + requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration { + return [[self alloc] initWithRequestType:FIRGetOOBConfirmationCodeRequestTypeEmailLink + email:email + accessToken:nil + actionCodeSettings:actionCodeSettings + requestConfiguration:requestConfiguration]; +} + - (nullable instancetype)initWithRequestType:(FIRGetOOBConfirmationCodeRequestType)requestType email:(nullable NSString *)email accessToken:(nullable NSString *)accessToken @@ -180,6 +198,12 @@ static NSString *const kVerifyEmailRequestTypeValue = @"VERIFY_EMAIL"; body[kIDTokenKey] = _accessToken; } + // For email sign-in link requests, we only need an email address in addition to the already + // required fields. + if (_requestType == FIRGetOOBConfirmationCodeRequestTypeEmailLink) { + body[kEmailKey] = _email; + } + if (_continueURL) { body[kContinueURLKey] = _continueURL; } |