I am developing a flutter app that include Google sign in. I the google_sign_in package to do so. The Google sign in works perfectly fine on my IOS simulator, but when I try to run it on an Android one it fails and throws this error.
PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)
The app throws the error right after the user selects their google account and before it sends the id token to the backend. Meaning that the problem is not with my backend (and again it works just fine on IOS).
I have researched this extensively, but I was unable to find a working solution.
I have tried:
- I have added a support email.
- I have ran
flutter clean - I have finished setting up my OAuth consent screen
- I have triple checked that my SHA1 key is correct.
- I have make sure that my client id is correct
- I have completely deleted my GCP project and created a new one from scratch.
- I have also tried messing with the android settings, but I do not have much experience with it and I could not find any good source.
I believe it has something to do with the android configuration, because it works fine on IOS. On IOS I needed to add the URI scheme to a config file maybe I need to the same on android, but I could not find any source that said if I do or how to do it.
This is my sign in code:
const List<String> scopes = <String>[
"https://www.googleapis.com/auth/userinfo.email",
];
final clientID = getGoogleClientId();
final googleSignIn = GoogleSignIn(
scopes: scopes,
serverClientId: clientID,
clientId: clientID,
);
// The code fails after this function
final user = await googleSignIn.signIn();
// Sending id token to my backend...
I can provide more code if you need.
Note: I have seen a lot of people with this problem that use firebase. I just want to clarify that I don't.