Since firebase is not needed in order to use this plugin I think the docs are confusing.
The get-config-file.md shows both options and what to do. All other docs assume you use firebase.
The documentation is build around GoogleService-Info.plist. From what I understand this file is only needed when firebase is used?! If it's needed without firebase it's even more confusing where and how to create this file. It's not clear which config step is needed when you don't use firebase.
Same as iOS guide. The docs focus on google-services.json. For example I got the DEVELOPER_ERROR but the troubleshooting is made for firebase users.
In general it's not easy to setup google sign in across both platforms. But if you are not using firebase it becomes a mess. I've been trying different configurations for days now. I'd love to contribute to improve the docs but unfortunately I am still guessing around in hope I get the right configuration. I hope it makes sense.
Thanks for bringing this up!
I've only used this library with Firebase and I'm not familiar how to set up this without it. As this library is just wrapper for native Google Sign library maintained by Google I'm pretty sure following Google's guides you'll be able to get it working without Firebase.
Android guide: https://developers.google.com/identity/sign-in/android/start-integrating
iOS guide: https://developers.google.com/identity/sign-in/ios/start-integrating
I hope this helps!
Thank you. I've already followed Googles Android guide but unfortunately I can't get it working. Always ending up in DEVELOPER_ERRROR or A non-recoverable sign in failure occurred.
I tried all possible solutions like different SHA fingerprints (release, debug and the one from play console), different signing configs in build.gradle and all kind of client ids. I don't use other google services so there is no conflict. I don't use app sharing. All plugins are up-to-date. I tried on emulator and real device, even pushed the code to play store and tested in beta release.
The only thing I noticed but nobody is talking about is the OAuth consent screen. I had to create an oauth consent screen before I was able to generate new credentials (client ids) in the developer console. The consent screen is being reviewed by google. This takes 4 to 6 weeks. I'm not sure if it's related to the problem. But I can't find any information about this.
But the same issue is discussed in #823
I checked
https://developers.google.com/identity/sign-in/android/start
https://developers.google.com/identity/sign-in/android/start-integrating
and found that native Google sign in requires only the following:
In your project's top-level build.gradle file, ensure that Google's Maven repository is included.
Then, in your app-level build.gradle file, declare Google Play services as a dependency:
apply plugin: 'com.android.application'
...
dependencies {
implementation 'com.google.android.gms:play-services-auth:18.1.0'
}
Based on that there is no need to update android/build.gradle with
googlePlayServicesAuthVersion = "16.0.1"
classpath 'com.google.gms:google-services:4.1.0'
and update android/app/build.gradle with
apply plugin: 'com.google.gms.google-services'
As we do not use google services there is no need to have google-services.json.
According to https://developers.google.com/identity/sign-in/android/start it need to set source of client id:
Your web server client ID is displayed next to Web client (Auto-created for Google Sign-in). Copy and paste the client ID into your project's strings.xml file:
<string name="server_client_id">YOUR_SERVER_CLIENT_ID</string>
I created android type OAuth client id for and put corresponding client id in strings.xml.
Important details during OAuth client id set up in dev console:
After I build the app and call
GoogleSignin.configure({
scopes: GOOGLE_OAUTH.scopes
})
and GoogleSignin.signIn()
Result was OK - logged in, but the only problem was token "idToken": null (I tried with native Google Sign in example com.google.samples.quickstart.signin and behaviour was the same)
I created a WEB type OAuth client and set its id as a parameter for
GoogleSignin.configure({
scopes: GOOGLE_OAUTH.scopes,
webClientId: GOOGLE_OAUTH.clientId,
})
And GoogleSignin.signIn() returned a valid idToken.
So it is working without firebase and google-service.json file.
During the tests I found a strange behaviour - if only google sign in with android id was ok then I could remove it from strings.xml or assign wrong values - the next sign in ignored this and worked fine some period of time even if clean build, rebuild, change virtual device,... till the moment when I removed android id on google dev console.
@TexxUkr Thanks a lot, this was the right solution in my case, identical to the issue described above.
here is my workaround for using Google API (no firebase)
we need both key Oauth2, web type for webClientID and android type to registering SHA-1 in google.
the detail here: https://github.com/react-native-google-signin/google-signin/issues/932
Most helpful comment
I checked
https://developers.google.com/identity/sign-in/android/start
https://developers.google.com/identity/sign-in/android/start-integrating
and found that native Google sign in requires only the following:
In your project's top-level build.gradle file, ensure that Google's Maven repository is included.
Then, in your app-level build.gradle file, declare Google Play services as a dependency:
apply plugin: 'com.android.application'
...
Based on that there is no need to update android/build.gradle with
googlePlayServicesAuthVersion = "16.0.1"
classpath 'com.google.gms:google-services:4.1.0'
and update android/app/build.gradle with
apply plugin: 'com.google.gms.google-services'
As we do not use google services there is no need to have google-services.json.
According to https://developers.google.com/identity/sign-in/android/start it need to set source of client id:
Your web server client ID is displayed next to Web client (Auto-created for Google Sign-in). Copy and paste the client ID into your project's strings.xml file:
<string name="server_client_id">YOUR_SERVER_CLIENT_ID</string>I created android type OAuth client id for and put corresponding client id in strings.xml.
Important details during OAuth client id set up in dev console:
After I build the app and call
GoogleSignin.configure({
scopes: GOOGLE_OAUTH.scopes
})
and GoogleSignin.signIn()
Result was OK - logged in, but the only problem was token "idToken": null (I tried with native Google Sign in example com.google.samples.quickstart.signin and behaviour was the same)
I created a WEB type OAuth client and set its id as a parameter for
GoogleSignin.configure({
scopes: GOOGLE_OAUTH.scopes,
webClientId: GOOGLE_OAUTH.clientId,
})
And GoogleSignin.signIn() returned a valid idToken.
So it is working without firebase and google-service.json file.
During the tests I found a strange behaviour - if only google sign in with android id was ok then I could remove it from strings.xml or assign wrong values - the next sign in ignored this and worked fine some period of time even if clean build, rebuild, change virtual device,... till the moment when I removed android id on google dev console.