Open Nynuzoud opened 6 years ago
any luck with this? I'm also facing the same issue. Double checked signing keys in firebase as well as google developer console, and it doesn't seem to be working.
No luck :( Still the same
Getting the same!
Me too!
Oh, great: This bug has been open over a year and a half and Google STILL hasn't replied to any of the developers reporting it!
@fractalbob The only workaround that I found was to click sign in button programatically if an exception like this happens!
Or execute recursively in the method that calls the operation, which is what I ended up doing:
private void processGmailSignIn(Intent data) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
// Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = task.getResult(ApiException.class);
firebaseAuthWithGoogle(account);
} catch (ApiException e) {
if (e.getStatusCode() == INTERNAL_ERROR) {
processGmailSignIn(data);
return;
}
}
}
I just realized this exception only happens when I try to do login when I've previously made a login in another device in the same app/project with the same Google account.
Logout the app on the other device to solve the problem.
Or execute recursively in the method that calls the operation, which is what I ended up doing:
private void processGmailSignIn(Intent data) { Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data); try { // Google Sign In was successful, authenticate with Firebase GoogleSignInAccount account = task.getResult(ApiException.class); firebaseAuthWithGoogle(account); } catch (ApiException e) { if (e.getStatusCode() == INTERNAL_ERROR) { processGmailSignIn(data); return; } } }
Above solution not working
I just realized this exception only happens when I try to do login when I've previously made a login in another device in the same app/project with the same Google account.
Logout the app on the other device to solve the problem.
It's been a 2 years already, I don't remember was I logged in from another device or not but anyway there're two questions:
Internal Error
?Any luck with this? I am facing the same issue, but I get the message 100% of the attempts, even clicking multiple times on the sign in button...
Support would be appreciated. +1 on "Internal error" doesn't help.
Are you getting the error on Google sign-in or passwordless email sign-in?
On Fri, Sep 23, 2022, 13:05 Persike @.***> wrote:
Any luck with this? I am facing the same issue, but I get the message 100% of the attempts, even clicking multiple times on the sign in button...
Support would be appreciated. +1 on "Internal error" doesn't help.
— Reply to this email directly, view it on GitHub https://github.com/googlesamples/google-services/issues/381#issuecomment-1256075692, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALTQDOL5NKG7OJAOU2OFK3V7WFH5ANCNFSM4FTR4LAQ . You are receiving this because you were mentioned.Message ID: @.***>
This problem occurs when:
UserRecoverableAuthException.getIntent()
to startActiviyForResult
a. Give consent without Drive Access onActivityResult
on GoogleSignIn.getSignedInAccountFromIntent(data).getResult(ApiException.class) ->
ApiException, with code 8
. only if allow processing with requestCode != -1
Facing the same issue. I've added the google-service.json
to my Android project, I'm logged in on the Emulator Device, I've checked all IDs and keys and also added the SHA-1 and SHA-256 to my Firebase project yet I keep getting the exception in getSignedInAccountFromIntent()
after running:
private fun signIn() {
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build()
val googleSignInClient = GoogleSignIn.getClient(this, gso)
val signInIntent = googleSignInClient.signInIntent
val task = GoogleSignIn.getSignedInAccountFromIntent(signInIntent)
try {
val auth = Firebase.auth
// Authenticate with Firebase using Google credentials
val account = task.getResult(ApiException::class.java)
val credential = GoogleAuthProvider.getCredential(account?.idToken, null)
auth.signInWithCredential(credential)
.addOnCompleteListener(this) { task ->
if (task.isSuccessful) {
// User is logged in, obtain JWT token and return to calling activity
val user = auth.currentUser
user?.getIdToken(true)?.addOnSuccessListener { result ->
val token = result.token
val resultIntent = Intent()
Timber.i(String.format("Logged in; Token %s", token))
resultIntent.putExtra("jwt_token", token)
setResult(Activity.RESULT_OK, resultIntent)
finish()
}
} else {
// Authentication failed, show error message
Toast.makeText(this, "Authentication failed.", Toast.LENGTH_SHORT).show()
}
}
} catch (e: ApiException) {
Timber.e(e);
// Google Sign-In failed, show error message
Toast.makeText(this, "Google sign-in failed.", Toast.LENGTH_SHORT).show()
}
}
Describe the problem:
ApiException: 8 after calling Task.getResult()
This error happens only first time you try login after app installation. Then, I'm clicking "Sign in button" to execute the code below. I'm choosing my google account and I'm catching ApiException: 8 that means "Internal Error" (https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes). So, I'm clicking "Sign in button" again and it works perfectly since that moment. I can logout and sign in as many times as I want and it will work.
If you clear data of the app, the error will not repeat. Also, it works without error on older devices with android 4.4.2, 5.1, 6, 7.1. Error appears also on emulator with Android version 9.
Steps to reproduce:
Relevant Code:
Task task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
GoogleSignInAccount account = task.getResult(ApiException.class);
// Signed in successfully, do something with account.
...
} catch (ApiException e) {
e.printStackTrace();
}