File tree 1 file changed +12
-7
lines changed
android/src/main/java/io/invertase/firebase/auth
1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -1314,13 +1314,18 @@ private void linkWithCredential(
1314
1314
if (exception instanceof FirebaseAuthUserCollisionException ) {
1315
1315
FirebaseAuthUserCollisionException authUserCollisionException = (FirebaseAuthUserCollisionException ) exception ;
1316
1316
AuthCredential updatedCredential = authUserCollisionException .getUpdatedCredential ();
1317
- firebaseAuth .signInWithCredential (updatedCredential ).addOnCompleteListener (getExecutor (), result -> {
1318
- if (result .isSuccessful ()) {
1319
- promiseWithAuthResult (result .getResult (), promise );
1320
- } else {
1321
- promiseRejectAuthException (promise , exception );
1322
- }
1323
- });
1317
+ try {
1318
+ firebaseAuth .signInWithCredential (updatedCredential ).addOnCompleteListener (getExecutor (), result -> {
1319
+ if (result .isSuccessful ()) {
1320
+ promiseWithAuthResult (result .getResult (), promise );
1321
+ } else {
1322
+ promiseRejectAuthException (promise , exception );
1323
+ }
1324
+ });
1325
+ } catch (Exception e ) {
1326
+ // we the attempt to log in after the collision failed, reject back to JS
1327
+ promiseRejectAuthException (promise , exception );
1328
+ }
1324
1329
} else {
1325
1330
promiseRejectAuthException (promise , exception );
1326
1331
}
You can’t perform that action at this time.
0 commit comments