CapacitorGoogleAuth
CapacitorGoogleAuth copied to clipboard
Problem with SignIn in android.
Hello everyone! I upgraded by application from capacitor 2 to capacitor 3. Now, I am facing issue with google login.
I am using @codetrix-studio/capacitor-google-auth": "3.0.1" plugin for this. And I am getting the following issue in android, for web its working fine for me.

I am having same issue
I was facing same issue. My web was working but not Android. So here is what i did:
- In addition to creating credentials (OAuth Client ID) for web https://console.cloud.google.com/apis/credentials, i did also for Android
- Then i went to https://console.firebase.google.com/u/ and created and Android project and downloaded the google-services.json and copied to my android -> app folder.
- I then ran
npx cap syncand run the app and it started working
Firebase Console:

Tried all combinations of both android client id and web client id - nothing works
Capactiror v3
Can u make a sample so we can check it out ?
Can u make a sample so we can check it out ?
if you have working solution, please record step by step video or text guide with screens
It was working fine on Capacitor 2 before the upgrade. Now I'm receiving this error for Android. Web is working fine, so I don't assume it's a credential issue (otherwise it would be bugged too?)
Please, help
After wasting some hours of my life, I've come up with a solution. It would be great if the plugin docs covered all of this, on the main page.
Probably this is happening due to a SHA1 signature mismatch between your debug app (the one you're trying to run in emulator) and firebase.
To fix it on Android studio 4.2, click on Gradle tab (right side) and type gradle signingReport
This will output in a panel on the bottom left a SHA1 debug key, that you must add to your firebase project settings
Now open Firebase, and add it:

Then try running your emulator again. It will probably work (I hope).
btw, my MainActivity.java is:
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth;
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerPlugin(GoogleAuth.class);
}
}
I was facing same issue. My web was working but not Android. So here is what i did:
- In addition to creating credentials (OAuth Client ID) for web https://console.cloud.google.com/apis/credentials, i did also for Android
- Then i went to https://console.firebase.google.com/u/ and created and Android project and downloaded the google-services.json and copied to my android -> app folder.
- I then ran
npx cap syncand run the app and it started workingFirebase Console:
It works for me, thanks.
The error after the migration from Capacitor 2 to 3 should be now fixed with the newer version.
According to my error logs in Sentry, about 10% of my users face this error. This is very strange. How it can work on some devices and don't work on others?
They've released outdated code for Android in npm. Try to install this plugin from the master branch
I also encountered the same mistake, but I did according to the answers of others above, and still reported this mistake
After wasting some hours of my life, I've come up with a solution. It would be great if the plugin docs covered all of this, on the main page.
Probably this is happening due to a SHA1 signature mismatch between your debug app (the one you're trying to run in emulator) and firebase.
To fix it on Android studio 4.2, click on Gradle tab (right side) and type gradle signingReport
This will output in a panel on the bottom left a SHA1 debug key, that you must add to your firebase project settings
Now open Firebase, and add it:
Then try running your emulator again. It will probably work (I hope).
btw, my MainActivity.java is:
import android.os.Bundle; import com.getcapacitor.BridgeActivity; import com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth; public class MainActivity extends BridgeActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); registerPlugin(GoogleAuth.class); } }
This did fix the issues on the android emulator. But I still have issues with real devices. I added the sha1 from my .keystore but it doesn't work. I have the "somethign went worng" error.
Still facing the issue. Everything was working perfectly before Capacitor 3.
I've triple checked every key, and everything is fine.
How can I fix/debug this ?
Still facing the issue. Everything was working perfectly before Capacitor 3.
I've triple checked every key, and everything is fine.
How can I fix/debug this ?
Not sure what exactly is your problem, but for me I had to add the SHA-1 key ,from google play, to my firebase project. I had the key from my .keystore but it didn't work.
On our Google Play Console. Go to, Setup->App Integrity, make sure you add this SHA-1 signing key
I spent a lot of time on this, hope it helps.
Still facing the issue. Everything was working perfectly before Capacitor 3. I've triple checked every key, and everything is fine. How can I fix/debug this ?
Not sure what exactly is your problem, but for me I had to add the SHA-1 key ,from google play, to my firebase project. I had the key from my .keystore but it didn't work.
On our Google Play Console. Go to, Setup->App Integrity, make sure you add this SHA-1 signing key
I spent a lot of time on this, hope it helps.
Hi, Thanks for the answer. I've tried what you've suggest but it's unfortunately not working neither. Do you see anything wrong on my setup ? All details in #154
Thanks!