CapacitorGoogleAuth: Getting error Something went wrong, code: 10
I’m trying to use this package for google sign in. I’m always getting this error
{"save":false,"callbackId":"40115251","pluginId":"GoogleAuth","methodName":"signIn","success":false,"error":{"message":"Something went wrong","code":"10"}}
I tried to follow the documentation as is, here is my configurations:
capacitor.config.json
{
"appId": "io.ionic.nostashteeb",
"appName": "Nos Tashteeb",
"webDir": "dist",
"bundledWebRuntime": false,
"plugins": {
"GoogleAuth": {
"scopes": ["profile", "email"],
"iosClientId": "",
"clientId": "CLIENT_ID.apps.googleusercontent.com",
"androidClientId": "CLIENT_ID.apps.googleusercontent.com",
"serverClientId": "CLIENT_ID.apps.googleusercontent.com",
"forceCodeForRefreshToken": true
}
}
}
strings.xml
<string name="server_client_id">CLIENT_ID.apps.googleusercontent.com</string>
MainActivity
registerPlugin(
com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.class
);
and then within my vue application using as
try {
const response = await GoogleAuth.signIn();
} catch (error) {
}
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
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 35 (1 by maintainers)
finally after 43 hrs continuous real struggle, me fixed it😃🥳👯🎈🎉🎊
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
Create an android application (i know make no sense)
2) capacitor.config.ts
3) Angular component
** 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 per their warnings) :p
Work for me thanks! in my case I see I put the IOS client id on the serverClientId lol
Glad it worked !! 🥳. Ahhh… Google and it’s policies😔
Thankyou Bro
Same issue. banging my head against the wall for the last few hours. Thought I was doing something wrong.
Maybe someone can add a PR faq section to the README with this problem?
I had this problem and followed all steps from @stevegtdbz but did not work until i specified a difrent port on the front end rather than http://localhost, i changed it for http://localhost:8100 and worked!
For me, the problem solved by using all 3:
…
@stevegtdbz ya ya in understand pal, my issue was my sha1 key was different than that i added on firebase for google auth. I am using google auth. Also ensure you have added
androidClientIdspecifcally for android in your capacitor config file. I m pretty sure this will work for you!! See bascially what i understood iscode error 10is totally related developer side issue, I have seen number of people already using this and succeed using the this google auth. Also google identiy is diffrerent and current auth is still supported , so currently we don’t need worry about migration!This error is the same as error #87.
This error code indicates an issue caused by the developer. Check if your client_id is valid. Verify that the fingerprint of the debug.keystore has been registered in the Firebase project settings. If it is not, redownload and replace the google-services.json file.