Open mohamednagy opened 1 year ago
After many days of searching & troubleshooting, it finally worked for me too! In my case, firebase is no needed.. i am just getting the "id_token" and sending it to my backend.. then i verify the token and grand access to my user.. so here is what followed: 1) Google console setup Create a web application
- Set into "Authorized JavaScript origins" & "Authorized redirect URIs" -> http://localhost to be able to test from your browser too, just add your serve port like http://localhost:4200
- On "Publishing status" set "in production"
- Now get the web_cllient_id and use it below on each config.GOOGLE_CLIENT_ID reference below
Create an android application (i know make no sense)
- Set Name & Package name.
- For the SHA1 go to android studio and use this one keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
2) capacitor.config.ts
plugins: { GoogleAuth: { scopes: ['profile', 'email'], clientId: conf.GOOGLE_CLIENT_ID, androidClientId: conf.GOOGLE_CLIENT_ID, serverClientId: conf.GOOGLE_CLIENT_ID, }, },
3) Angular component
GoogleAuth.initialize({ clientId: config.GOOGLE_CLIENT_ID, scopes: ['profile', 'email'], })
async googleSignIn() { let googleUser = await GoogleAuth.signIn(); //todo }
** On android project have only registered the plugin, nothing else registerPlugin(com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.class); @OnlinePage You had right! I also used a new key and worked fine! but i also found another one from an old project in case google decides to shut down the new ones (as their warnings) :p
Glad it worked !! đŸ¥³. Ahhh... Google and it's policiesđŸ˜”
Worked like a charm. Thank you. In my case adding android app did it.
This worked for me. Thank you!
For me, the problem solved by using all 3:
clientId: google_web_client_id, androidClientId: google_web_client_id, serverClientId: google_web_client_id,
....
Those three are the same ?
I had the same issue, the problem was solved by having an android client id (with the sha-1 fingerprint) and a regular web application client id in the google console credentials, while initializing the plugin use the web application client id, but in the capacitor config json I used the android client id.
Also make sure to test this using the corresponding certificates for that sha-1 fingerprint
I'm trying to use this package for google sign in. I'm always getting this error
I tried to follow the documentation as is, here is my configurations:
capacitor.config.json
strings.xml
MainActivity
and then within my vue application using as
I created my client_id from the google cloud console and copied my SHA1 to the google cloud console but still always getting this error.
capacitor: ^5.1.0 @codetrix-studio/capacitor-google-auth: ^3.3.2