2

I have trying to implement Google Sign In on my app by following the guide. https://developers.google.com/identity/sign-in/android/start-integrating#add_google_play_services

However, I keep getting error 10 everytime I go to try to log in and I know it means its a developer error but, I cant figure out what I am doing wrong. I implemented all the code, made sure I have the correct packages and updated Android Studio.

I tried different client ids from SHA1 hashes that came from multiple generated signed bundles and apks for my app. I tried the pre generated one that Google gives you for sign-in. Any ideas?

Intent for google sign in

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .requestIdToken(getString(R.string.server_client_id)) .build(); googleSignInClient = GoogleSignIn.getClient(getActivity(),gso); Intent signInIntent = googleSignInClient.getSignInIntent(); startActivityForResult(signInIntent, 21); 

OnActivityResult function

 @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { callbackManager.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data); if(requestCode == 21) { Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data); handleSignInResult(task); } else if (resultCode == RESULT_CANCELED) { Log.d("frag", "intent fired and something went wrong"); } } 

handleSignInResult function

 private void handleSignInResult(Task<GoogleSignInAccount> completedTask) { try { GoogleSignInAccount account = completedTask.getResult(ApiException.class); // Signed in successfully, show authenticated UI. Log.d("frag", "Email of account is " + account.getEmail()); } catch (ApiException e) { // The ApiException status code indicates the detailed failure reason. // Please refer to the GoogleSignInStatusCodes class reference for more information. Log.w("ytsignin", "signInResult:failed code=" + e.getStatusCode()); } } 

1 Answer 1

4

Check the SHA-1 code and package name in developer console. Most of the time it is what causes the error 10 which is 'DEVELOPER_ERROR'. Check the SHA-1 in console against the one you get from Android Studio after running signingReport.enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.