Ardeshir ojan
Ardeshir ojan

Reputation: 2429

google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)

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

Answers (8)

Dilan Nde
Dilan Nde

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

user2265209
user2265209

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

Sam1324
Sam1324

Reputation: 380

If someone is still struggling, try with SHA-1 Key not SHA-256.

Upvotes: -1

nur zazin
nur zazin

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

Code on the Rocks
Code on the Rocks

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

Nandom Kumchi
Nandom Kumchi

Reputation: 239

The error happens mostly when you have not registered the SHA1 key on the App on firebase. To generate the SHA1 Key:

  1. Navigate to lib/android of your project on your terminal
  2. Run ./gradlew signingReport

enter image description here

Finally Goto firebase auth on your Firebase Console and enable Google Sign-in

Upvotes: 2

Viraj Dhanushka
Viraj Dhanushka

Reputation: 71

If you are using Firebase,

  1. Go to app/build.gradle

  2. Make sure the applicationId Under defaultConfig is same as the Package name in Firebase Project (see below)

    defaultConfig { applicationId "com.ceylonguider.app" … }

Package name in Firebase Project.

Upvotes: 3

Razvan Tmz
Razvan Tmz

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.

  1. run ./gradlew signingReport
    ./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
  1. go to the path: Store: ~/.android/debug.keystore
  2. copy debug.keystore in your root project
  3. go to app/build.gradle
  4. add this in the android { ... } section
signingConfigs {
        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

Related Questions