Reputation: 83
After reading through countless similar issues e.g.:
and other documentation, changing my Firebase configuration, google-services.json, creating and recreating countless Gogle Cloud credentials, I have finally decided to post my issue here in hopes of help from others.
My Flutter app is supposed to connect with the Google Calendar of the user logging in, to synchronize their events in their calendar across their devices.
This requires the sensitive scopes:
static const List<String> scopes = ['https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/calendar.events'];
Secondly, to sign in with google, I tried using https://pub.dev/packages/googleapis_auth, but after that failed due to Googles migration away from loopback URLs, I found https://pub.dev/packages/extension_google_sign_in_as_googleapis_auth, which uses https://pub.dev/packages/google_sign_in to let the user sign in, and then provide me with an AuthClient.
Trying this out successfully opens a dialog to the user, asking them, which Google Account they would like to sign in with, but upon selecting any, I get the (now dreaded) com.google.android.gms.common.api.ApiException: 10
Through reading issues others had with Google oAuth, I found the following, leading me to my current configuration:
gradlew signingReport
GoogleSignIn _googleSignIn = GoogleSignIn(
clientId: debugClientId, // Technically unused
serverClientId: debugClientId,
forceCodeForRefreshToken: true,
scopes: scopes,
);
GoogleSignInAccount currentUser? = await _googleSignIn.signIn()
However, this just yields the issue as described above, here with its complete StackTrace:
I/flutter ( 6057): PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)
I/flutter ( 6057): #0 GoogleSignInApi.signIn (package:google_sign_in_android/src/messages.g.dart:221:7)
I/flutter ( 6057): <asynchronous suspension>
I/flutter ( 6057): #1 GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:278:30)
I/flutter ( 6057): <asynchronous suspension>
I/flutter ( 6057): #2 GoogleSignIn.signIn.isCanceled (package:google_sign_in/google_sign_in.dart:431:5)
I/flutter ( 6057): <asynchronous suspension>
I/flutter ( 6057): PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)
I/flutter ( 6057): #0 GoogleSignInApi.signIn (package:google_sign_in_android/src/messages.g.dart:221:7)
I/flutter ( 6057): <asynchronous suspension>
I/flutter ( 6057): #1 GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:278:30)
I/flutter ( 6057): <asynchronous suspension>
I/flutter ( 6057): #2 GoogleSignIn.signIn.isCanceled (package:google_sign_in/google_sign_in.dart:431:5)
I/flutter ( 6057): <asynchronous suspension>
At this point, I am considering canceling the feature entirely and staying with local calendars, as it is not a core feature, but this has to work somehow, right?
Upvotes: 6
Views: 1473
Reputation: 21
You may try to check again the instructions from the link (https://developers.google.com/android/guides/client-auth), or you may check the video (https://www.youtube.com/watch?v=W3Zno0j4kiU&list=PLxefhmF0pcPmTIE0yl7wNw7JqUceYuL_L&index=3&pp=iAQB) which might also help you to check if you get a SHA correctly, or if you missed out something.
If you are using Internal App Sharing, you may refer to this link (PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null) when using Flutter to build an appbundle), there is another App Signing certificate fingerprint you need to add. On the left navigation of Google Play Console go to: Developer Tools -> Internal App Sharing
If ways above do not help, you may refer to the link (Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)) and find for more answer.
Upvotes: 1