1

I am trying to sign in to google by google_sign_in package that I added to dependencies and this error comes when I sign in to an account after I sign in successfully but it doesn't show anything. error : I/flutter ( 7069): PlatformException(sign_in_failed,com.google.android.gms.common.api.ApiException: 10: , null) here is my code :

GoogleSignIn _googleSignIn = GoogleSignIn(
  scopes: <String>[
    'email',
    'https://www.googleapis.com/auth/contacts.readonly',
  ],
);

void main() {
  runApp(
    MaterialApp(
      title: 'Google Sign In',
      home: SignIn(),
    ),
  );
}

class SignIn extends StatefulWidget {
  @override
  State createState() => SignInState();
}

class SignInState extends State<SignIn> {
  GoogleSignInAccount _currentUser;
  String _contactText;
  bool checkBoxValue = false;
  double _height;
  double _width;
  double _pixelRatio;
  bool _large;
  bool _medium;

  @override
  void initState() {
    super.initState();
    _googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount account) {
      setState(() {
        _currentUser = account;
      });
      if (_currentUser != null) {
        _handleGetContact();
      }
    });
    _googleSignIn.signInSilently();
  }
Future<void> _handleSignIn() async {
    try {
      await _googleSignIn.signIn();
    } catch (error) {
      print(error);
    }
  }

any ideas??

Omar Yacop
  • 37
  • 1
  • 9

1 Answers1

2

This exception generally appears in 2 cases

  1. You are using invalid Google API key
  2. You have given the wrong Fingerprint in the Google cloud console
Guru Prasad mohapatra
  • 1,809
  • 13
  • 19