aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m
diff options
context:
space:
mode:
Diffstat (limited to 'Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m')
-rw-r--r--Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m95
1 files changed, 85 insertions, 10 deletions
diff --git a/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m b/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m
index cf0dda5..653eddd 100644
--- a/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m
+++ b/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeRequest.m
@@ -16,13 +16,15 @@
#import "FIRGetOOBConfirmationCodeRequest.h"
+#import "FIRActionCodeSettings.h"
+
#import "FIRAuthErrorUtils.h"
#import "FIRAuth_Internal.h"
/** @var kEndpoint
@brief The getOobConfirmationCode endpoint name.
*/
-static NSString *const kEndpoint = @"getOobConfirmationCode";
+static NSString *const kGetOobConfirmationCodeEndpoint = @"getOobConfirmationCode";
/** @var kRequestTypeKey
@brief The name of the required "requestType" property in the request.
@@ -40,6 +42,38 @@ static NSString *const kEmailKey = @"email";
*/
static NSString *const kIDTokenKey = @"idToken";
+/** @var kContinueURLKey
+ @brief The key for the "continue URL" value in the request.
+ */
+static NSString *const kContinueURLKey = @"continueUrl";
+
+/** @var kIosBundeIDKey
+ @brief The key for the "iOS Bundle Identifier" value in the request.
+ */
+static NSString *const kIosBundleIDKey = @"iOSBundleId";
+
+/** @var kAndroidPackageNameKey
+ @brief The key for the "Android Package Name" value in the request.
+ */
+static NSString *const kAndroidPackageNameKey = @"androidPackageName";
+
+/** @var kAndroidInstallAppKey
+ @brief The key for the request parameter indicating whether the android app should be installed
+ or not.
+ */
+static NSString *const kAndroidInstallAppKey = @"androidInstallApp";
+
+/** @var kAndroidMinimumVersionKey
+ @brief The key for the "minimum Android version supported" value in the request.
+ */
+static NSString *const kAndroidMinimumVersionKey = @"androidMinimumVersion";
+
+/** @var kCanHandleCodeInAppKey
+ @brief The key for the request parameter indicating whether the action code can be handled in
+ the app or not.
+ */
+static NSString *const kCanHandleCodeInAppKey = @"canHandleCodeInApp";
+
/** @var kPasswordResetRequestTypeValue
@brief The value for the "PASSWORD_RESET" request type.
*/
@@ -57,12 +91,15 @@ static NSString *const kVerifyEmailRequestTypeValue = @"VERIFY_EMAIL";
@param requestType The types of OOB Confirmation Code to request.
@param email The email of the user.
@param accessToken The STS Access Token of the currently signed in user.
- @param APIKey The client's API Key.
+ @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
+ settings to be applied to the OOB code request.
+ @param requestConfiguration An object containing configurations to be added to the request.
*/
- (nullable instancetype)initWithRequestType:(FIRGetOOBConfirmationCodeRequestType)requestType
email:(nullable NSString *)email
accessToken:(nullable NSString *)accessToken
- APIKey:(nullable NSString *)APIKey
+ actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
+ requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration
NS_DESIGNATED_INITIALIZER;
@end
@@ -83,31 +120,45 @@ static NSString *const kVerifyEmailRequestTypeValue = @"VERIFY_EMAIL";
}
}
-+ (FIRGetOOBConfirmationCodeRequest *)passwordResetRequestWithEmail:(NSString *)email
- APIKey:(NSString *)APIKey {
++ (FIRGetOOBConfirmationCodeRequest *)
+ passwordResetRequestWithEmail:(NSString *)email
+ actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
+ requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration {
return [[self alloc] initWithRequestType:FIRGetOOBConfirmationCodeRequestTypePasswordReset
email:email
accessToken:nil
- APIKey:APIKey];
+ actionCodeSettings:actionCodeSettings
+ requestConfiguration:requestConfiguration];
}
+ (FIRGetOOBConfirmationCodeRequest *)
- verifyEmailRequestWithAccessToken:(NSString *)accessToken APIKey:(NSString *)APIKey {
+ verifyEmailRequestWithAccessToken:(NSString *)accessToken
+ actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
+ requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration {
return [[self alloc] initWithRequestType:FIRGetOOBConfirmationCodeRequestTypeVerifyEmail
email:nil
accessToken:accessToken
- APIKey:APIKey];
+ actionCodeSettings:actionCodeSettings
+ requestConfiguration:requestConfiguration];
}
- (nullable instancetype)initWithRequestType:(FIRGetOOBConfirmationCodeRequestType)requestType
email:(nullable NSString *)email
accessToken:(nullable NSString *)accessToken
- APIKey:(nullable NSString *)APIKey {
- self = [super initWithEndpoint:kEndpoint APIKey:APIKey];
+ actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
+ requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration {
+ self = [super initWithEndpoint:kGetOobConfirmationCodeEndpoint
+ requestConfiguration:requestConfiguration];
if (self) {
_requestType = requestType;
_email = email;
_accessToken = accessToken;
+ _continueURL = actionCodeSettings.URL.absoluteString;
+ _iOSBundleID = actionCodeSettings.iOSBundleID;
+ _androidPackageName = actionCodeSettings.androidPackageName;
+ _androidMinimumVersion = actionCodeSettings.androidMinimumVersion;
+ _androidInstallApp = actionCodeSettings.androidInstallIfNotAvailable;
+ _handleCodeInApp = actionCodeSettings.handleCodeInApp;
}
return self;
}
@@ -129,6 +180,30 @@ static NSString *const kVerifyEmailRequestTypeValue = @"VERIFY_EMAIL";
body[kIDTokenKey] = _accessToken;
}
+ if (_continueURL) {
+ body[kContinueURLKey] = _continueURL;
+ }
+
+ if (_iOSBundleID) {
+ body[kIosBundleIDKey] = _iOSBundleID;
+ }
+
+ if (_androidPackageName) {
+ body[kAndroidPackageNameKey] = _androidPackageName;
+ }
+
+ if (_androidMinimumVersion) {
+ body[kAndroidMinimumVersionKey] = _androidMinimumVersion;
+ }
+
+ if (_androidInstallApp) {
+ body[kAndroidInstallAppKey] = @YES;
+ }
+
+ if (_handleCodeInApp) {
+ body[kCanHandleCodeInAppKey] = @YES;
+ }
+
return body;
}