Signing in via Google account does not work

131 Views Asked by At

Does anyone know how to fix this? Everything works on the emulator:

enter image description here

But not on a real device:

enter image description here

I use this package to log in to my account through Google: https://pub.dev/packages/firebase_ui_oauth_google

Here is the code to sign in:

Future<UserCredential> signInWithGoogle() async {
 final GoogleSignInAccount? googleUser = await 
 GoogleSignIn().signIn();

 final GoogleSignInAuthentication? googleAuth =
    await googleUser?.authentication;

 final credential = GoogleAuthProvider.credential(
   accessToken: googleAuth?.accessToken,
   idToken: googleAuth?.idToken,
 );

 return await 
FirebaseAuth.instance.signInWithCredential(credential);

}

1

There are 1 best solutions below

0
CesareIsHere On

I think that it could be related to SHA1 key. Did you configurated it?

Here the official documentation' screen with steps to follow: enter image description here

Link: https://firebase.google.com/docs/auth/flutter/federated-auth#ios+-and-android