1

First Image:

enter image description here

Second Image: enter image description here

Here is my code to create the GoogleSignInOptions object. In the requestIdToken argument, I put the web client id from the firebase console of my app(Check first image). But i read an article that web client id should be created on the page "https://console.developers.google.com/apis/credentials?project=feisty-truth-232713&folder&organizationId" (Check second image) So I created a new project, and on the Oath consent screen I fetched the OAuth 2.0 client ID.

So basically I have tried both the client ids(first image and second image)

    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(String.valueOf(R.string.google_default_web_client_id))
            .requestEmail()
            .build();

but in the below code, while retrieving the google sign in account, i get the "com.google.android.gms.common.api.ApiException: 10" exception. Can anybody tell where im going wrong. I tried the answer "Firebase UI authentication with google fails with message (code:10 message:10)" but my issue prevails.

 @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        //if the requestCode is the Google Sign In code that we defined at starting
        if (requestCode == RC_SIGN_IN) {

            //Getting the GoogleSignIn Task
            Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
            try {
                //Google Sign In was successful, authenticate with Firebase
                GoogleSignInAccount account = task.getResult(ApiException.class);
                //authenticating with firebase
                firebaseAuthWithGoogle(account);
            } catch (ApiException e) {
                Toast.makeText(LoginActivity.this, e.getMessage()+e.toString(), Toast.LENGTH_SHORT).show();
                Log.d(TAG, "onActivityResult: "+e.toString()+"  "+e.getLocalizedMessage());
            }
        }
    }
Shikhar
  • 644
  • 1
  • 10
  • 20
  • Uh, is the web client ID considered sensitive content? As in the type that can be abused? The secret is also half exposed there, you might want to consider cropping the screenshots more and hide those entirely – Zoe Feb 25 '19 at 07:54
  • thanks for the suggestion, but its a test app, so i have done my part by hiding the key partially. No more secrecy is required – Shikhar Feb 25 '19 at 08:02
  • The partial hiding still makes it possible to reconstruct. The English alphabet isn't that complicated to piece together from half a line. – Zoe Feb 25 '19 at 08:02
  • alright i'll see to it...for now, if you can help in finding the solution I would be really grateful – Shikhar Feb 25 '19 at 09:23
  • Hey, did you find the solution ? – Ana Koridze Sep 29 '19 at 13:24

0 Answers0