Reputation: 2429
I have a Flutter app with Google sign-in. I have added the SHA1 and SHA256 keys to Firebase, from a computer. and everything is alright from that computer.
but when I run the app from other computers I get this error
PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
I have added also added support email as well. how can I fix this?
Upvotes: 8
Views: 11826
Reputation: 11
I recently ran into the same issue while developing my app. I started off in debug mode and, following the docs, I added the SHA-1 and SHA-256 keys to the Firebase project settings. Everything was working fine so far. But when I switched to the release version to see how my app behaves in that environment, I started encountering errors.
I tried a bunch of different solutions, including directly adding the key to Google Cloud GCP interface to add restrictions to API keys, but none of that worked. After some more troubleshooting, I decided to try adding the key back to Firebase's project settings. And to my surprise, that fixed the issue! Now, everything works as expected in both debug and release mode. Firebase project settings As you can see I have 4 keys now(2 for debugging and 2 for release)
So, if you're facing similar issues, make sure you've added both SHA-1 and SHA-256 keys to Firebase's project settings. That might just do the trick!
Upvotes: 1
Reputation: 1
there are many reasons why you would get PlatformException (sign_in_failed) exception.
I fixed my issue by adding 'App signing key certificate' keys from Play Console (SHA-1 & SHA-256) to firebase consoles's Android app > 'SDK setup and configuration'. production app start working soon as adds this without having to do another release.
Upvotes: 0
Reputation: 1189
this is work on me. it just edit file gradle.properties
then append this key and value on latest line.
org.gradle.java.home=/Users/username/Library/Java/JavaVirtualMachines/corretto-21.0.4/Contents/Home
my JDK is using corretto-21. if you are using openJDK use this...
org.gradle.java.home=/Users/username/Library/Java/JavaVirtualMachines/openjdk-23/Contents/Home
Upvotes: 0
Reputation: 17794
My issue was that the applicationId
in app/build.gradle was wrong. When I created my app, I mistakenly set the --org
value to my_org
instead of com.my_org
.
Updating this fixed my issue.
Upvotes: 0
Reputation: 239
The error happens mostly when you have not registered the SHA1 key on the App on firebase. To generate the SHA1 Key:
lib/android
of your project on your terminal./gradlew signingReport
Finally Goto firebase auth on your Firebase Console and enable Google Sign-in
Upvotes: 2
Reputation: 71
If you are using Firebase,
Go to app/build.gradle
Make sure the applicationId
Under defaultConfig
is same as the Package name
in Firebase Project (see below)
defaultConfig { applicationId "com.ceylonguider.app" … }
Upvotes: 3
Reputation: 136
This happens because Firebase(and others) need to have the sha for each key registered. By default, android studio creates a debug signing key. When you collaborate with other people, you can create a key(or copy the one generated by AS) and set it up for the project.
./gradlew signingReport
> Task :app:signingReport
Variant: debug
Config: debug
Store: ~/.android/debug.keystore
Alias: AndroidDebugKey
MD5: A5:88:41:04:8D:06:71:6D:FE:33:76:87:AC:AD:19:23
SHA1: A7:89:E5:05:C8:17:A1:22:EA:90:6E:A6:EA:A3:D4:8B:3A:30:AB:18
SHA-256: 05:A2:2C:35:EE:F2:51:23:72:4D:72:67:A5:6C:8C:58:22:2A:00:D6:DB:F6:45:D5:C1:82:D2:80:A4:69:A8:FE
Valid until: Wednesday, August 10, 2044
Store: ~/.android/debug.keystore
debug.keystore
in your root projectapp/build.gradle
android { ... }
sectionsigningConfigs {
debug {
storeFile file("../debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
}
push your changes and now everybody will use the same debug key and you don't need to register different SHA for every developer.
This is different than the release key, which you should never push on Git.
Upvotes: 8