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 3 years ago
- Comments: 60 (5 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
PlayStore problem fixed!!! I created a new OAuth - Type Android, using Fingerprint of “App Signing Key Certificate” (SHA-1)
Summarizing: -> At Google Cloud Console, create OAuth type: Web Application and use it to everything in your code! (See video above to get all needed places… it’s a lot)
-> Back to Google Cloud Console, create accordingly OAuth(s) type: Android, that won’t be used anywhere by you but they need to be there, created and configured since Google needs it to proceed their validations and authorize Login. To make it work properly on every environment, follow:
For Local/Simulator: debug.keystore SHA-1 terminal:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass androidSigned .APK: Upload key certificate SHA-1 terminal:
keytool -list -v -alias yourkey -keystore ~/path-to-your-key/yourkeythen type your defined password and get SHA-1Signed .AAB (Published on AppStore): App signing key certificate SHA-1 Go to Google Play Console > Setup (sidebar menu) > App Sign
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😔
Worked like a charm. Thank you. In my case adding android app did it.
Maybe someone can add a PR faq section to the README with this problem?
Thankyou Bro
@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!Same issue. banging my head against the wall for the last few hours. Thought I was doing something wrong.
Those three are the same ?
In my case, after having applied all suggestions collected here and in other related issue, the sign-in on android started to work when I used the web client id instead of android client id.
I can live with that, but… can anyone explain me why???
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:
…
I solved it by using the SHA1 from the Android Studio Terminal when running this command “./gradlew signingReport” I got it from the google docs: https://developers.google.com/android/guides/client-auth
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.