I am trying to add Google Sign In to my Android App. I have followed the instructions in the below link:
https://developers.google.com/identity/sign-in/android/start-integrating
I have dougle checked that all the pre-requisites are met: 1. I have API version 27, Google Play Services Version 49, Google Repository version 58. I also have created a keystore (JKS) for debug, and have the App signed (Android Studio: File --> Project Structure --> (modules) app -> then configured Signing, Flavors and Build types tabs using this keystore and the alias created. I have then created a Project in Google Cloud console, created OAuth Credential for Android and have configured the SHA1 fingerprint, and have made sure that the package name is as per the manifest file.
However, the below code always results in APIException (com.google.android.gms.common.api.ApiException: 10:, Status{statusCode=DEVELOPER_ERROR, resolution=null} ).
I have followed the code snippets as per the below link:https://developers.google.com/identity/sign-in/android/sign-in
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
try {
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
// Signed in successfully, show authenticated UI.
String k="";
} catch (ApiException e) {
// The ApiException status code indicates the detailed failure reason.
}
}
I then deleted the Android OAuth Credential in Google Cloud Console project, and then created a Web Application project and tried using the client id in my Android code, which also did not work. I got the same exception. What am I doing wrong here?
I also would like to know what is the use of the Client Secret (downloadable JSON file) showing up in my OAUth creadential in the Google cloud console project?
I also have read some articles in which it is mentioned about Google-services.json file which I have not added to my project because the Google developers documentation I have followed (mentioned above) does not mention such an activity. I also have not seen such a file in Google Cloud Console, inside my project's OAuth credentials. Am I missing something here?
If you want to customize Games sign-in options, you can build a configuration via new GoogleSignInOptions.
You have added a debug SHA-1 key in firebase console
You need to add release SHA-1 key in firebase console
You can generate release SHA-1 key by following steps :
:<AppName>
-> android -> signingReport (double click it).this will generate signing SHA-1 key and you can see it in Run
option in android studio below tab.
Note:- There will be debug and release both SHA-1 keys will present in Run
tab. You need to pick release SHA-1 key. (If you didn't find release SHA-1 key, double check that you have added release configs in app level build.gradle
file).
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