@@ -193,13 +193,14 @@ + (FlutterError *)convertToFlutterError:(NSError *)error {
193193 additionalData[kArgumentEmail ] = [error userInfo ][FIRAuthErrorUserInfoEmailKey];
194194 }
195195 // We want to store the credential if present for future sign in if the exception contains a
196- // credential
197- [FLTFirebaseAuthPlugin storeAuthCredentialIfPresent: error];
196+ // credential, we pass a token back to Flutter to allow retreival of the credential.
197+ NSNumber *token = [FLTFirebaseAuthPlugin storeAuthCredentialIfPresent: error];
198198
199199 // additionalData.authCredential
200200 if ([error userInfo ][FIRAuthErrorUserInfoUpdatedCredentialKey] != nil ) {
201201 FIRAuthCredential *authCredential = [error userInfo ][FIRAuthErrorUserInfoUpdatedCredentialKey];
202- additionalData[@" authCredential" ] = [PigeonParser getPigeonAuthCredential: authCredential];
202+ additionalData[@" authCredential" ] = [PigeonParser getPigeonAuthCredential: authCredential
203+ token: token];
203204 }
204205
205206 // Manual message overrides to ensure messages/codes matches other platforms.
@@ -641,14 +642,16 @@ static void handleAppleAuthResult(FLTFirebaseAuthPlugin *object, AuthPigeonFireb
641642
642643#pragma mark - Utilities
643644
644- + (void )storeAuthCredentialIfPresent:(NSError *)error {
645+ + (NSNumber *_Nullable )storeAuthCredentialIfPresent:(NSError *)error {
645646 if ([error userInfo ][FIRAuthErrorUserInfoUpdatedCredentialKey] != nil ) {
646647 FIRAuthCredential *authCredential = [error userInfo ][FIRAuthErrorUserInfoUpdatedCredentialKey];
647648 // We temporarily store the non-serializable credential so the
648649 // Dart API can consume these at a later time.
649650 NSNumber *authCredentialHash = @([authCredential hash ]);
650651 credentialsMap[authCredentialHash] = authCredential;
652+ return authCredentialHash;
651653 }
654+ return nil ;
652655}
653656
654657- (FIRAuth *_Nullable)getFIRAuthFromAppNameFromPigeon:(AuthPigeonFirebaseApp *)pigeonApp {
0 commit comments