@@ -343,6 +343,15 @@ void AuthResultCallback(FIRAuthDataResult *_Nullable fir_auth_result, NSError *_
343343 }
344344 }
345345
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+
346355 ReferenceCountedFutureImpl &futures = auth_data->future_impl ;
347356 futures.CompleteWithResult (handle, AuthErrorFromNSError (error),
348357 util::NSStringToString (error.localizedDescription).c_str(), result);
@@ -353,6 +362,16 @@ void AuthResultCallback(FIRUser *_Nullable user, NSError *_Nullable error,
353362 User *current_user = AssignUser (user, auth_data);
354363 AuthResult auth_result;
355364 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+
356375 ReferenceCountedFutureImpl &futures = auth_data->future_impl ;
357376 futures.CompleteWithResult (handle, AuthErrorFromNSError (error),
358377 util::NSStringToString (error.localizedDescription).c_str(),
@@ -414,7 +433,7 @@ void SignInResultCallback(FIRAuthDataResult *_Nullable auth_result, NSError *_Nu
414433 util::NSDictionaryToStdMap (auth_result.additionalUserInfo.profile, &result.info.profile);
415434 }
416435
417- if (error.userInfo != nullptr ) {
436+ if (error != nullptr && error .userInfo != nullptr ) {
418437 if (error.userInfo [FIRAuthErrorUserInfoUpdatedCredentialKey] != nullptr ) {
419438 result.info .updated_credential = ServiceUpdatedCredentialProvider::GetCredential (
420439 new FIRAuthCredentialPointer (error.userInfo [FIRAuthErrorUserInfoUpdatedCredentialKey]));
0 commit comments