Skip to content

Commit

Permalink
fix(auth, android): gracefully handle exception creating PhoneCredential
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehardy committed Nov 16, 2020
1 parent 532adb5 commit 8ead604
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -991,10 +991,17 @@ public void confirmationResultConfirm(
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);

PhoneAuthCredential credential = PhoneAuthProvider.getCredential(
mVerificationId,
verificationCode
);
PhoneAuthCredential credential = null;
try {
credential = PhoneAuthProvider.getCredential(
mVerificationId,
verificationCode
);
} catch (Exception e) {
Log.d(TAG, "confirmationResultConfirm::getCredential::failure", e);
promiseRejectAuthException(promise, e);
return;
}

firebaseAuth.signInWithCredential(credential).addOnCompleteListener(getExecutor(), task -> {
if (task.isSuccessful()) {
Expand Down

0 comments on commit 8ead604

Please sign in to comment.