Open sbellver opened 3 years ago
Hi guys, I have the same problem. Any update?
I'm in the same situation, any change.
I see maybe the error is ApiException: 10 ( https://github.com/CodetrixStudio/CapacitorGoogleAuth/issues/15 ) but have not success after change SHA1 in firebase for production & devel
To get the sha1 for your app, if helps:
keytool -list -v -keystore ~/path/to/myApp.Keystore -alias myAlias
Maybe is not compatible with Capacitor 3 & Android yet?
I think main problem is the SHA1 fingerprint, using keytool didn't work, when I tried to create an Andodroid API from google console it didn't accepted it.
So I solved it doing the following:
1 - https://stackoverflow.com/a/34223470 , option 2: Work with Google Maps Activity
2 - Then go to google console, create a new oath for android and use the SHA1 you got from stackoverflow solution.
3 - After that you shoud go to firebase, create a new project but be carefull there, when ask for project name wait until show all yours google console projects (don't create a new one from scratch) and select the project from 2.
4 - Activate google auth and copy the client id web from Firebase and use THIS code, not the google console one.
I followed a lot of steps but none of them was very specific about this point which is the most strange to me. Please if you need more detail in some point let me know.
I'm having the same issue. It works on IOS and web but I cannot login in an android device.
I'm still blocked.
If I run
keytool -list -v \
-alias androiddebugkey -keystore ~/.android/debug.keystore
I get an SHA1
If I run @aguirrel solution, I have another one.
Well, I create a new Oauth Credential in https://console.cloud.google.com/apis/credentials?project=MYPROJECT
Then, go to firebase: https://console.firebase.google.com/project/MYPROJECT/settings/general/android:my.app
And add the another SHA1 (from Google Maps hint)
Then go back to My Credentials, and copy ID KEY from web client
And then copy this id into code
But no result, always have error API 10
And me too with same error. Works on web and ios, but not android. I am just testing in android emulator, but tried with the signed apk and debug with same error.
OK I fixed my issue. Turns out it seems the google-services.json I had in place for push notifications then overrides any client key in google api console.
What I did:
Then bingo, no more error code 10.
I can't get this to work with capacitor 3.
The dialog with the google account selection shows up but when i select an account it's com.google.android.gms.common.api.ApiException: 10
I'm pretty sure my SHA1 is correct, Gradle signing report and keytool show the same fingerprint and I use it for the android app links too
no matter if I use the android client id or the web client id, it's always exception time
After many hours with SHA1, keys, clients ID, etc... I finally found (here) the solution that worked for me.
I simply added
<string name="server_client_id">REPLACEME.apps.googleusercontent.com</string>
in this file: android/app/src/main/res/values/strings.xml
Now sign-in progress is OK and no more console error shown.
I did other tests, and I figure out that google-services.json
file seems to be useless. If I remove it, everything keeps to work fine.
Even in the capacitor.config.json the value for androidClientId seems to be ininfluent. I tried with a foo value, and I still have no errors. I report this just for reference - i.e: I will keep anyway json file and androidClientId in their places.
I'm using Capacitor 3
After many hours with SHA1, keys, clients ID, etc... I finally found (here) the solution that worked for me. I simply added
<string name="server_client_id">REPLACEME.apps.googleusercontent.com</string>
in this file:android/app/src/main/res/values/strings.xml
Now sign-in progress is OK and no more console error shown. I did other tests, and I figure out thatgoogle-services.json
file seems to be useless. If I remove it, everything keeps to work fine. Even in the capacitor.config.json the value for androidClientId seems to be ininfluent. I tried with a foo value, and I still have no errors. I report this just for reference - i.e: I will keep anyway json file and androidClientId in their places. I'm using Capacitor 3
That did the trick!
@sjdrew Thanks man. Saved my day. Though I didn't follow the whole procedure. I just copy-paste the "type: 3" id instead of "type: 1"
Hi all.
I'm on Capacitor 3 and Vue 2 (quasar framework).
In iOs all works fine.
In android, when I click on the button shows the gmail accounts. Then select the account and notching happens .
I can see in the log:
It's like the plugin are not present in android target.
But If I run npx cap sync android:
In androidClientId I set the name of de app: domain.name
I set server_client_id as google-services.json and copy this file into android/app/
I register the plugin in MainApplication.java
But doesn't work in android.