diff --git a/FirebaseAuth/Sources/Utilities/FIRAuthRecaptchaVerifier.m b/FirebaseAuth/Sources/Utilities/FIRAuthRecaptchaVerifier.m index 9e7bb0380c8..dc8627a5179 100644 --- a/FirebaseAuth/Sources/Utilities/FIRAuthRecaptchaVerifier.m +++ b/FirebaseAuth/Sources/Utilities/FIRAuthRecaptchaVerifier.m @@ -122,10 +122,14 @@ - (void)verifyForceRefresh:(BOOL)forceRefresh } }); } else { + NSLog(@"reCAPTCHA verification faled because reCAPTCHA SDK " + @"not linked."); completion(nil, [FIRAuthErrorUtils recaptchaSDKNotLinkedError]); } } else { + NSLog(@"reCAPTCHA verification faled because reCAPTCHA SDK " + @"not linked."); completion(nil, [FIRAuthErrorUtils recaptchaSDKNotLinkedError]); } @@ -156,10 +160,12 @@ - (void)retrieveRecaptchaConfigForceRefresh:(BOOL)forceRefresh callback:^(FIRGetRecaptchaConfigResponse *_Nullable response, NSError *_Nullable error) { if (error) { + NSLog(@"reCAPTCHA config retrieval failed."); completion(error); } NSLog(@"reCAPTCHA config retrieval succeeded."); FIRAuthRecaptchaConfig *config = [[FIRAuthRecaptchaConfig alloc] init]; + // Response's site key is of the format projects//keys/' config.siteKey = [response.recaptchaKey componentsSeparatedByString:@"/"][3]; NSMutableDictionary *tmpEnablementStatus = [NSMutableDictionary dictionary]; for (NSDictionary *state in response.enforcementState) { @@ -208,16 +214,18 @@ - (void)retrieveRecaptchaTokenWithAction:(FIRAuthRecaptchaAction)action [[RecaptchaActionClass alloc] init], customActionSelector, actionToStringMap[@(action)]); if (customAction) { - [self.recaptchaClient execute:customAction - completion:^(NSString *_Nullable token, NSError *_Nullable error) { - if (!error) { - NSLog(@"reCAPTCHA token retrieval succeeded."); - completion(token, nil); - return; - } else { - completion(kFakeToken, nil); - } - }]; + [self.recaptchaClient + execute:customAction + completion:^(NSString *_Nullable token, NSError *_Nullable error) { + if (!error) { + NSLog(@"reCAPTCHA token retrieval succeeded."); + completion(token, nil); + return; + } else { + NSLog(@"reCAPTCHA token retrieval failed. NO_RECAPTCHA sent as the fake code."); + completion(kFakeToken, nil); + } + }]; } } else { completion(nil, [FIRAuthErrorUtils recaptchaSDKNotLinkedError]);