未处理的异常:PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)

Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)

I'm trying to make google login with flutter app, and I got this error. I've already get and put SHA-1 key to OAuth and Firebase and set google-services.json file under app directory. But I still got same problem.

 E/flutter (12401): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)
E/flutter (12401): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (12401): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
E/flutter (12401): <asynchronous suspension>
E/flutter (12401): #2      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
E/flutter (12401): <asynchronous suspension>
E/flutter (12401): #3      GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:235:30)
E/flutter (12401): <asynchronous suspension>
E/flutter (12401): #4      GoogleSignIn.signIn.isCanceled (package:google_sign_in/google_sign_in.dart)
E/flutter (12401): <asynchronous suspension>
E/flutter (12401): 

This is how I set.

GCP OAuth

Firebase setting - I filled all blanks

and I don't know which clientId has to be on this area.

which clientId has to be on this area?

I got 4 clientId because I already used google clientId to make django web login with google

第 1 步: 将此依赖项添加到您的 pubsec 文件中

firebase: ^9.0.2
  firebase_core: ^1.2.1
  firebase_database: ^7.1.0
  firebase_auth: ^1.2.0
  font_awesome_flutter: ^9.0.0
  google_sign_in: ^5.0.3

步骤:2 创建一个新的 dart 文件并粘贴此代码

import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';

class FirebaseService {
  final FirebaseAuth _auth = FirebaseAuth.instance;
  final GoogleSignIn _googleSignIn = GoogleSignIn();

  Future<String?> signInwithGoogle() async {
    try {
      final GoogleSignInAccount? googleSignInAccount =
          await _googleSignIn.signIn();
      final GoogleSignInAuthentication googleSignInAuthentication =
          await googleSignInAccount!.authentication;
      final AuthCredential credential = GoogleAuthProvider.credential(
        accessToken: googleSignInAuthentication.accessToken,
        idToken: googleSignInAuthentication.idToken,
      );
      await _auth.signInWithCredential(credential);
    } on FirebaseAuthException catch (e) {
      print(e.message);
      throw e;
    }
  }

  Future<void> signOutFromGoogle() async{
    await _googleSignIn.signOut();
    await _auth.signOut();
  }
}

第 3 步: 使用 google 功能呼叫登录:

启用 Google 登录 Firebase 将您的 SHA 1 密钥添加到 Firebase 项目