CapacitorGoogleAuth
CapacitorGoogleAuth copied to clipboard
Always showing 10:Something Went Wrong error - Ionic5 Capacitor4 Android
I am getting always 10:Something Went Wrong error while trying to login to google. Following are the steps I have done and my configurations/versions.
Configurations done in console :
Capacitor.config.ts :
What am I missing?
I have same problem, using version 3.1.4
, ionic 5 with capacitor 3. As reference, it seems to work in iOS devices and in browser, the error only occurs in Android device
Any idea?
It works if you do the next steps:
- capacitor:
3.5.1
, perhaps this works in v4 - ionic:
5
- CapacitorGoogleAuth:
3.1.4
- capacitor.config.ts
const config: CapacitorConfig = {
...,
plugins: {
GoogleAuth: {
scopes: ['profile', 'email'],
androidClientId: "YOUR_WEB_CLIENT_ID.apps.googleusercontent.com",
iosClientId: "YOUR_IOS_CLIENT_ID.apps.googleusercontent.com",
forceCodeForRefreshToken: true
},
},
};
The CLIENT_ID for ANDROID must be the WEB_CLIENT_ID otherwise it will not work

Google Cloud Console/Credentials
- Web client Authorized JS Origins
Add your localhost:port
to the list
- strings.xml
Add server_client_id
string to the file with your WEB_CLIENT_ID
<string name="server_client_id">YOUR_WEB_CLIENT_ID.apps.googleusercontent.com</string>
- MainActivity.java
Import the plugin and use registerPlugin
instead of init
(init is deprecated)
import com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth;
import com.getcapacitor.BridgeActivity;
public class MainActivity extends BridgeActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
this.registerPlugin(GoogleAuth.class);
super.onCreate(savedInstanceState);
}
}
This works for me!
Maybe you´ll find that interesting: https://ionicframework.com/blog/announcing-capacitor-4-0/ New Google Policy will put some pressure to maintain this project by lifting capacitor support to version 4
Hey @gilzonme, Are you using Firebase? I have the same problem and think it might be related to my Firebase configuration.
Hey @gilzonme, Are you using Firebase? I have the same problem and think it might be related to my Firebase configuration.
It worked for me now.
Did you find the cause? How did you get it working?
Same for me... all those solutions don't work :( Cap 4 Ionic 6
Unable to find a Capacitor plugin to handle requestCode, trying Cordova plugins Sending plugin error: {"save":false,"callbackId":"120447529","pluginId":"GoogleAuth","methodName":"signIn","success":false,"error":{"message":"Something went wrong","code":"12500"}} 2022-08-26 01:39:28.301 3167-3167/io.lewapp.vocabulary D/Capacitor/AppPlugin: Firing change: true 2022-08-26 01:39:28.301 3167-3167/io.lewapp.vocabulary V/Capacitor/AppPlugin: Notifying listeners for event appStateChange 2022-08-26 01:39:28.301 3167-3167/io.lewapp.vocabulary D/Capacitor/AppPlugin: No listeners found for event appStateChange 2022-08-26 01:39:28.301 3167-3167/io.lewapp.vocabulary D/Capacitor: App resumed 2022-08-26 01:39:28.318 3167-3167/io.lewapp.vocabulary E/Capacitor/Console: File: http://localhost/vendor.js - Line 83313 - Msg: ERROR Error: Uncaught (in promise): Error: Something went wrong Error: Something went wrong at returnResult (http://localhost/:422:32) at Object.win.androidBridge.onmessage (http://localhost/:397:21)
I got it running now by stepping back to a Capacitor 3 version of my code and the re-executed the Cap4 migration. Maybe there was a problem with Capacitor that got fixed in the last days, because I carefully tracked my code changes and didn't see anything that could've caused the GoogleAuth problems. Suspiciously, when GoogleAuth gave me that 10-error-code, my Facebook login didn't work as well. The Facebook login errored out because of a wrong hash. So I think that somehow with the Cap4 migration the hashing of security keys got broken and that caused the 10-error-code at GoogleAuth.
@carsten-klaffke somehow the issue was solved... I kept all the same configs(recommended setup config as described by @CodeRevenge here...
Just removed all testing virtual devices
Re-added it again - TiramisuPrivacySandbox
And... At the first start again an error...
I logged-in in PlayMarket on the emulator - it works!
Tomorrow I'll try to test the app on a real device... Need to try clearing/resetting default settings...
It works if you do the next steps:
- capacitor:
3.5.1
, perhaps this works in v4- ionic:
5
- CapacitorGoogleAuth:
3.1.4
- capacitor.config.ts
const config: CapacitorConfig = { ..., plugins: { GoogleAuth: { scopes: ['profile', 'email'], androidClientId: "YOUR_WEB_CLIENT_ID.apps.googleusercontent.com", iosClientId: "YOUR_IOS_CLIENT_ID.apps.googleusercontent.com", forceCodeForRefreshToken: true }, }, };
The CLIENT_ID for ANDROID must be the WEB_CLIENT_ID otherwise it will not work
![]()
Google Cloud Console/Credentials
- Web client Authorized JS Origins
Add your
localhost:port
to the list
- strings.xml
Add
server_client_id
string to the file with your WEB_CLIENT_ID<string name="server_client_id">YOUR_WEB_CLIENT_ID.apps.googleusercontent.com</string>
- MainActivity.java
Import the plugin and use
registerPlugin
instead ofinit
(init is deprecated)import com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth; import com.getcapacitor.BridgeActivity; public class MainActivity extends BridgeActivity { @Override protected void onCreate(Bundle savedInstanceState) { this.registerPlugin(GoogleAuth.class); super.onCreate(savedInstanceState); } }
This works for me!
This is still the solution in Capacitor 4
On our side the underlying issue was that somehow the SHA1 of our app changed with capacitor 4 migration. We had to add the new fingerprint to the Android App settings in firebase console and then the login was working again.
Reference: https://stackoverflow.com/questions/49450140/google-signin-api-exception-10
In addition to the WEB Client ID you MUST have the SHA-1 Android key in GCloud added in the OAuth credentials even though the Android client ID is never mentioned anywhere in the Capacitor Google Auth code.
One other thing I ran into was that the key didn't transfer correctly from the changes in the capacitor.config.ts file to the android files. Make sure you run
ionic capacitor build android
to do this.
I only have the
- clientId in capacitor.config.json
- (androidClientId in my capacitor.config.ts file). not sure if this one is used
- server_client_id in strings.xml
- clientId in the init code for the plugin (for Web platform)
All of them the web client ID value.
Hello, @EugeneKruglei I am facing the same issue, the above suggestions didn't help me. I am using @ionic/[email protected], capacitor4.2.0, @codetrix-studio/[email protected]. Did you solve the Google Login issue?
Same problem. Can someone suggest something else ?
I managed to resolve this issue deleting the android app I previously created in the overview page of my project in firebase and creating it again with the app id, sha1 and app name.
The same issue... Using Capacitor 4
Also used android key and WebClient key
Apaparently there is an error between the debug.keytore and the release.keystore. When I add the debug.keystore in the google console (OAuth 2.0 Client IDs - Android Client) and I build the grandle with this in android studio, everything works. But when I add the release.keystore in the google console , it only works for the web and not for android or ios. What is going on? This is very weird.
Can anyone help ?
I also had problems, but the video helped me. For me, the problem was that an "Authorised JavaScript sources" was missing in the gcp console.
https://www.youtube.com/watch?v=Ay9F6WHfnkU
We had the same issue. We fixed it by setting the androidClientId to the server_client_id value.
Diffing 3.0.2 and 3.2.0 shows that the clientId was read from server_client_id and is now androidClientId.
In 3.0.2:
String clientId = this.getContext().getString(R.string.server_client_id);
became in 3.2.0
String clientId = getConfig().getString("androidClientId",
getConfig().getString("clientId",
this.getContext().getString(R.string.server_client_id)));
Facing Same error on Release build only.
When building debug build on mobile and adding debug SHA-1
to google console received from android studio it works. But when release on playstore and adding SHA-1 from developer console it shows error 10. What exactly i am missing here?
what exactly is the javascript origin? i have added default one http://localhost:8100
as my origin.
When building debug build on mobile and adding debug SHA-1 to google console received from android studio it works. But when release on playstore and adding SHA-1 from developer console it shows error 10. What exactly i am missing here?
@Saqib92 I think your issue is different. The behavior you get is expected, since Google Play generates a different SHA-1. You should also find & and that to the console.
When building debug build on mobile and adding debug SHA-1 to google console received from android studio it works. But when release on playstore and adding SHA-1 from developer console it shows error 10. What exactly i am missing here?
@Saqib92 I think your issue is different. The behavior you get is expected, since Google Play generates a different SHA-1. You should also find & and that to the console.
where can i find it in Google Play?
When building debug build on mobile and adding debug SHA-1 to google console received from android studio it works. But when release on playstore and adding SHA-1 from developer console it shows error 10. What exactly i am missing here?
@Saqib92 I think your issue is different. The behavior you get is expected, since Google Play generates a different SHA-1. You should also find & and that to the console.
where can i find it in Google Play?
There are multiple ways,
From Google Cloud Console: 1 - Go to Google Cloud Console and log in with your Google Sign-in account. 2- Select the related project from the top (this could be a firebase/google cloud project) 3- Search for API/s clients 4- From the left menu select Credentials 5- In this menu you should see list of autogenerated items under OAuth 2.0 Client IDs. Select the relevant client & you will see the SHA1 key here.
From the APK: 1- Download the APK from Google Play Store. This medium article might help. 2- Learn the SHA1 from this APK, you can use install & use keytool here. SO post
When building debug build on mobile and adding debug SHA-1 to google console received from android studio it works. But when release on playstore and adding SHA-1 from developer console it shows error 10. What exactly i am missing here?
@Saqib92 I think your issue is different. The behavior you get is expected, since Google Play generates a different SHA-1. You should also find & and that to the console.
where can i find it in Google Play?
There are multiple ways,
From Google Cloud Console: 1 - Go to Google Cloud Console and log in with your Google Sign-in account. 2- Select the related project from the top (this could be a firebase/google cloud project) 3- Search for API/s clients 4- From the left menu select Credentials 5- In this menu you should see list of autogenerated items under OAuth 2.0 Client IDs. Select the relevant client & you will see the SHA1 key here.
From the APK: 1- Download the APK from Google Play Store. This medium article might help. 2- Learn the SHA1 from this APK, you can use install & use keytool here. SO post
looks like I already done almost same.
Someone with the same error still? I have set client id for android the same as fo web but always code 10 error. Onl yandroid do not work. web and iOS is fine
Why do I need to use firebase to fix this error, I tried everything so far.. nothing works still errors .. 10
MainActivity.java
public class MainActivity extends BridgeActivity { public void onCreate(Bundle savedInstanceState) { registerPlugin(GoogleAuth.class); super.onCreate(savedInstanceState); } }
Strings.xml added -
Created the following - (but didn't use Andriod client id anywhere).
It works for web, ios, but doesn't work for Android.
It gives the following error -- D/CompatibilityChangeReporter: Compat change id reported: 78294732; UID 10159; state: ENABLED D/Capacitor: Unable to find a Capacitor plugin to handle requestCode, trying Cordova plugins 147138663 D/Capacitor: Sending plugin error: {"save":false,"callbackId":"1887292","pluginId":"GoogleAuth","methodName":"signIn","success":false,"error":{"message":"Something went wrong","code":"10"}}
MainActivity.java
public class MainActivity extends BridgeActivity { public void onCreate(Bundle savedInstanceState) { registerPlugin(GoogleAuth.class); super.onCreate(savedInstanceState); } }
Strings.xml added - Added web_cilent_id
Created the following - (but didn't use Andriod client id anywhere).
It works for web, ios, but doesn't work for Android.
It gives the following error -- D/CompatibilityChangeReporter: Compat change id reported: 78294732; UID 10159; state: ENABLED D/Capacitor: Unable to find a Capacitor plugin to handle requestCode, trying Cordova plugins 147138663 D/Capacitor: Sending plugin error: {"save":false,"callbackId":"1887292","pluginId":"GoogleAuth","methodName":"signIn","success":false,"error":{"message":"Something went wrong","code":"10"}}
I think google deprecated use .. on google console code 10 had a message saying no longer supported.
I am using google auth in ionic ,sign in with google popup is opening but its throwing error message: 'Something went wrong', code: '10'
Yes webview isn't supported in Auth anymore due to security, you can't handle the response from outside of the android unless you handle it somewhere else .. you'll have to handle the code inside androids Java..