onmyway133 / blog

🍁 What you don't know is what you haven't learned
https://onmyway133.com/
MIT License
677 stars 33 forks source link

How to fix ApiException: 10 in Flutter for Android #188

Open onmyway133 opened 5 years ago

onmyway133 commented 5 years ago

Get error com.google.android.gms.common.api.ApiException: 10 with google_sign_in package.

Read https://developers.google.com/android/guides/client-auth

Certain Google Play services (such as Google Sign-in and App Invites) require you to provide the SHA-1 of your signing certificate so we can create an OAuth2 client and API key for your app

console.developers.google.com/apis/credentials

Credentials -> OAuth client id If we specify SHA1 in firebase, then console.developers.google.com will generate an Android oauth for us

keytool -list -v -keystore {keystore_name} -alias {alias_name}

Use correct keystore for debug and release

buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
        debug {
            signingConfig signingConfigs.debug
        }
    }
Fightlapa commented 5 years ago

What if I'm also using backend and I use client id of my backed credentials which does not require any SHA-1 or anything?

shredding commented 4 years ago

If you run into problems in release mode albeit you've added your release sha1 to firebase, add the release key from play store as well:

https://play.google.com/console/developers/<your-company-id>/app/<your-app-id>/keymanagement