Home > OS >  Google sign_in_failed error in a Flutter app using firebase auth
Google sign_in_failed error in a Flutter app using firebase auth

Time:11-20

I'm developing a Flutter mobile app and testing things on an Android emulator.

I'm using Firebase to handle auth logic.

I created a service

class AuthService {
  Future<void> googleLogin() async {
    try {
      final googleUser = await GoogleSignIn().signIn();

      if (googleUser == null) return;

      final googleAuth = await googleUser.authentication;
      final authCredential = GoogleAuthProvider.credential(
        accessToken: googleAuth.accessToken,
        idToken: googleAuth.idToken
      );

      await FirebaseAuth.instance.signInWithCredential(authCredential);
    } on FirebaseAuthException catch (e) {
      // handle the error
    }
  }
}

that I call on the press of a button. I do authenticate with my Google account, however, then the terminal shows this error

PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 12500: , null, null)

I read online that this is due to missing SHA credentials in my firebase project. So I generated these credentials using ./gradlew signingReport from the android directory within the project. I then added the certificates (both SHA-1 and SHA-256 to the android app in my flutter project.

I downloaded again the Google services file provided by Firebase, run flutter clean and flutter run but I'm still facing the very same issue when I try to login.

Why is this happening? Am I missing anything?

CodePudding user response:

you have to add a support email id in your Firebase console like this

enter image description here

  • Related