Skip to content

Commit 3b415e6

Browse files
authored
fix(auth, ios): fix the parsing of an error that could specifically happen when using MicrosoftProvider (#12920)
1 parent 704afb8 commit 3b415e6

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

packages/firebase_auth/firebase_auth/ios/Classes/FLTFirebaseAuthPlugin.m

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,24 @@ static void handleAppleAuthResult(FLTFirebaseAuthPlugin *object, AuthPigeonFireb
595595
underlyingError.userInfo[@"FIRAuthErrorUserInfoDes"
596596
@"erializedResponseKey"];
597597

598-
if (firebaseDictionary != nil && firebaseDictionary[@"message"] != nil) {
598+
if (firebaseDictionary == nil &&
599+
userInfo[@"FIRAuthErrorUserInfoNameKey"] != nil) {
600+
// Removing since it's not parsed and causing issue when sending back the
601+
// object to Flutter
602+
NSMutableDictionary *mutableUserInfo = [userInfo mutableCopy];
603+
[mutableUserInfo
604+
removeObjectForKey:@"FIRAuthErrorUserInfoUpdatedCredentialKey"];
605+
NSError *modifiedError = [NSError errorWithDomain:error.domain
606+
code:error.code
607+
userInfo:mutableUserInfo];
608+
609+
completion(nil,
610+
[FlutterError errorWithCode:@"sign-in-failed"
611+
message:userInfo[@"NSLocalizedDescription"]
612+
details:modifiedError.userInfo]);
613+
614+
} else if (firebaseDictionary != nil &&
615+
firebaseDictionary[@"message"] != nil) {
599616
// error from firebase-ios-sdk is
600617
// buried in underlying error.
601618
completion(nil,

0 commit comments

Comments
 (0)