I am using firebase for google authentication in my flutter app. I registered app in the firebase and set all configurations like adding SHA1 and SHA256 key, and all. However, I get the error:
final FirebaseAuth _auth = FirebaseAuth.instance;
final GoogleSignIn googleSignIn = new GoogleSignIn();
Future<FirebaseUser> _signIn() async{
GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
GoogleSignInAuthentication googleSignInAuthentication = await googleSignInAccount.authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
accessToken: googleSignInAuthentication.accessToken,
idToken: googleSignInAuthentication.idToken
);
final FirebaseUser user = await _auth.signInWithCredential(credential);
print("Sign In "+user.displayName);
return user;
}
It is needed to return user credentials. However, It throws following error.
PlatformException (PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null))
As per the links Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null), I have added my mail for mail support, added google-services.json file. However, that doesn't solve my problem.