@@ -343,6 +343,15 @@ void AuthResultCallback(FIRAuthDataResult *_Nullable fir_auth_result, NSError *_
343
343
}
344
344
}
345
345
346
+ // If there is an error, and it has an updated credential, pass that along via the result.
347
+ if (error != nullptr && error.userInfo != nullptr ) {
348
+ if (error.userInfo [FIRAuthErrorUserInfoUpdatedCredentialKey] != nullptr ) {
349
+ result.additional_user_info .updated_credential =
350
+ ServiceUpdatedCredentialProvider::GetCredential (new FIRAuthCredentialPointer (
351
+ error.userInfo [FIRAuthErrorUserInfoUpdatedCredentialKey]));
352
+ }
353
+ }
354
+
346
355
ReferenceCountedFutureImpl &futures = auth_data->future_impl ;
347
356
futures.CompleteWithResult (handle, AuthErrorFromNSError (error),
348
357
util::NSStringToString (error.localizedDescription).c_str(), result);
@@ -353,6 +362,16 @@ void AuthResultCallback(FIRUser *_Nullable user, NSError *_Nullable error,
353
362
User *current_user = AssignUser (user, auth_data);
354
363
AuthResult auth_result;
355
364
if (current_user != nullptr ) auth_result.user = *current_user;
365
+
366
+ // If there is an error, and it has an updated credential, pass that along via the result.
367
+ if (error != nullptr && error.userInfo != nullptr ) {
368
+ if (error.userInfo [FIRAuthErrorUserInfoUpdatedCredentialKey] != nullptr ) {
369
+ auth_result.additional_user_info .updated_credential =
370
+ ServiceUpdatedCredentialProvider::GetCredential (new FIRAuthCredentialPointer (
371
+ error.userInfo [FIRAuthErrorUserInfoUpdatedCredentialKey]));
372
+ }
373
+ }
374
+
356
375
ReferenceCountedFutureImpl &futures = auth_data->future_impl ;
357
376
futures.CompleteWithResult (handle, AuthErrorFromNSError (error),
358
377
util::NSStringToString (error.localizedDescription).c_str(),
@@ -414,7 +433,7 @@ void SignInResultCallback(FIRAuthDataResult *_Nullable auth_result, NSError *_Nu
414
433
util::NSDictionaryToStdMap (auth_result.additionalUserInfo.profile, &result.info.profile);
415
434
}
416
435
417
- if (error.userInfo != nullptr ) {
436
+ if (error != nullptr && error .userInfo != nullptr ) {
418
437
if (error.userInfo [FIRAuthErrorUserInfoUpdatedCredentialKey] != nullptr ) {
419
438
result.info .updated_credential = ServiceUpdatedCredentialProvider::GetCredential (
420
439
new FIRAuthCredentialPointer (error.userInfo [FIRAuthErrorUserInfoUpdatedCredentialKey]));
0 commit comments