Google Sign In PlatformException(exception, BAD_REQUEST, null, null) on Flutter

Viewed 174

This problem occurs on some devices, I tried in Pixel 4 XL API 30, API 29 and real device no problem, but in Pixel 4 API 30 got this error: PlatformException(exception, BAD_REQUEST, null, null)

try {
  final GoogleSignIn googleSignIn = GoogleSignIn();
  final GoogleSignInAccount? googleUser = await googleSignIn.signIn(); // Receive my Google Account details
  if (googleUser == null) return;

  final googleAuth = await googleUser.authentication; // <-- Catch error here

  credential = GoogleAuthProvider.credential(
    accessToken: googleAuth.accessToken,
    idToken: googleAuth.idToken
  );
} catch (e) {
  print(e); // PlatformException(exception, BAD_REQUEST, null, null)
}

Why does it happen on some devices? Is there a way to solve this problem?

0 Answers
Related