I am using these below lines of code for G+ sign-in android integration.
In app build.gradle :
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
In MainActivity :
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestIdToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.com")
.requestProfile()
.build();
AppCompatActivity appCompatActivity = (AppCompatActivity) context;
googleApiClient = new GoogleApiClient.Builder(context)
.enableAutoManage(appCompatActivity, this)
.addConnectionCallbacks(this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.addApi(Plus.API)
.build();
I have also added "google-services.gson" file at app level. I have also made web-application and use client-id for requestIdToken() parameter.
requestIdToken(client-id of webapp).
After writing this code, Still I am getting status code = 12501 in response and tokenId = null.
I have also read this link. But Can not find any solution.
You need to add the credentials for both your signed and debug client_id
in the google-services.json
file like this:
"oauth_client": [
{
"client_id": "<your-client-id>",
"client_type": 1,
"android_info": {
"package_name": "<your-package-name>",
"certificate_hash": "<hash>"
}
},
{
"client_id": "<your-client-id-2>",
"client_type": 1,
"android_info": {
"package_name": "<your-package-name-2>",
"certificate_hash": "<hash-2>"
}
}
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With