Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Google Sign In error logging #25446

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/components/SignInButtons/GoogleSignIn/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ function googleSignInRequest() {
.then((response) => response.idToken)
.then((token) => Session.beginGoogleSignIn(token))
.catch((error) => {
// Handle unexpected error shape
if (error === undefined || error.code === undefined) {
Log.alert(`[Google Sign In] Google sign in failed: ${error}`);
}
/** The logged code is useful for debugging any new errors that are not specifically handled. To decode, see:
- The common status codes documentation: https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes
- The Google Sign In codes documentation: https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInStatusCodes
*/
if (error.code === statusCodes.SIGN_IN_CANCELLED) {
Log.alert('[Google Sign In] Google sign in cancelled', true, {error});
} else if (error.code === statusCodes.IN_PROGRESS) {
Log.alert('[Google Sign In] Google sign in already in progress', true, {error});
} else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
Log.alert('[Google Sign In] Google play services not available or outdated', true, {error});
Log.info('[Google Sign In] Google Sign In cancelled');
} else {
Log.alert('[Google Sign In] Unknown Google sign in error', true, {error});
Log.alert(`[Google Sign In] Error Code: ${error.code}. ${error.message}`, {}, false);
}
});
}
Expand Down
Loading