Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit a90c328

Browse files
authored
Don't use resultCode when handling SignIn result
1 parent 50e2ec8 commit a90c328

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/google_sign_in/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,13 @@ public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
492492
}
493493
return true;
494494
case REQUEST_CODE_SIGNIN:
495-
if (resultCode == Activity.RESULT_OK && data != null) {
495+
// Whether resultCode is OK or not, the Task returned by GoogleSigIn will determine
496+
// failure with better specifics which are extracted in onSignInResult method.
497+
if (data != null) {
496498
onSignInResult(GoogleSignIn.getSignedInAccountFromIntent(data));
497-
} else if (resultCode == Activity.RESULT_CANCELED) {
498-
finishWithError(ERROR_REASON_SIGN_IN_CANCELED, "User canceled sign in");
499499
} else {
500-
finishWithError(ERROR_REASON_STATUS, "Sign in failed with " + resultCode);
500+
// data is null which is highly unusual for a sign in result.
501+
finishWithError(ERROR_REASON_SIGN_IN_FAILED, "Signin failed");
501502
}
502503
return true;
503504
default:

0 commit comments

Comments
 (0)