@@ -153,14 +153,19 @@ - (void)verifyPhoneNumber:(NSString *)phoneNumber
153
153
completion (nil , error);
154
154
return ;
155
155
}
156
- [self reCAPTCHAURLWithCompletion: ^(NSURL *_Nullable reCAPTCHAURL,
157
- NSError *_Nullable error) {
156
+ NSMutableString *eventID = [[NSMutableString alloc ] init ];
157
+ for (int i=0 ; i<10 ; i++) {
158
+ [eventID appendString:
159
+ [NSString stringWithFormat: @" %c " , ' a' + arc4random_uniform (' z' - ' a' + 1 )]];
160
+ }
161
+ [self reCAPTCHAURLWithEventID: eventID completion: ^(NSURL *_Nullable reCAPTCHAURL,
162
+ NSError *_Nullable error) {
158
163
if (error) {
159
164
callBackOnMainThread (nil , error);
160
165
return ;
161
166
}
162
167
FIRAuthURLCallbackMatcher callbackMatcher = ^BOOL (NSURL *_Nullable callbackURL) {
163
- return [self isVerifyAppURL: callbackURL];
168
+ return [self isVerifyAppURL: callbackURL eventID: eventID ];
164
169
};
165
170
[_auth.authURLPresenter presentURL: reCAPTCHAURL
166
171
UIDelegate: UIDelegate
@@ -275,7 +280,7 @@ - (NSString *)reCAPTCHATokenForURL:(NSURL *)URL error:(NSError **)error {
275
280
@param URL The url to be checked against the authType string.
276
281
@return Whether or not the URL matches authType.
277
282
*/
278
- - (BOOL )isVerifyAppURL : (nullable NSURL *)URL {
283
+ - (BOOL )isVerifyAppURL : (nullable NSURL *)URL eventID : ( NSString *) eventID {
279
284
if (!URL) {
280
285
return NO ;
281
286
}
@@ -297,7 +302,8 @@ - (BOOL)isVerifyAppURL:(nullable NSURL *)URL {
297
302
NSURL *deeplinkURL = [NSURL URLWithString: URLQueryItems[@" deep_link_id" ]];
298
303
NSDictionary <NSString *, NSString *> *deeplinkQueryItems =
299
304
[NSDictionary gtm_dictionaryWithHttpArgumentsString: deeplinkURL.query];
300
- if ([deeplinkQueryItems[@" authType" ] isEqualToString: kAuthTypeVerifyApp ]) {
305
+ if ([deeplinkQueryItems[@" authType" ] isEqualToString: kAuthTypeVerifyApp ] &&
306
+ [deeplinkQueryItems[@" eventId" ] isEqualToString: eventID]) {
301
307
return YES ;
302
308
}
303
309
return NO ;
@@ -423,7 +429,7 @@ - (void)verifyClientWithCompletion:(FIRVerifyClientCallback)completion {
423
429
}];
424
430
}
425
431
426
- - (void )reCAPTCHAURLWithCompletion : (FIRReCAPTCHAURLCallBack)completion {
432
+ - (void )reCAPTCHAURLWithEventID : ( NSString *) eventID completion : (FIRReCAPTCHAURLCallBack)completion {
427
433
[self fetchAuthDomainWithCompletion: ^(NSString *_Nullable authDomain,
428
434
NSError *_Nullable error) {
429
435
if (error) {
@@ -438,7 +444,8 @@ - (void)reCAPTCHAURLWithCompletion:(FIRReCAPTCHAURLCallBack)completion {
438
444
@" authType" : kAuthTypeVerifyApp ,
439
445
@" ibi" : bundleID ?: @" " ,
440
446
@" clientId" : clienID,
441
- @" v" : [FIRAuthBackend authUserAgent ]
447
+ @" v" : [FIRAuthBackend authUserAgent ],
448
+ @" eventId" : eventID,
442
449
}];
443
450
if (_auth.requestConfiguration .languageCode ) {
444
451
urlArguments[@" hl" ] = _auth.requestConfiguration .languageCode ;
0 commit comments