我搜索了整个互联网,尝试了所有可能的解决方案,但我仍然无法从我的 flutter 应用程序中使用 GoogleSignIn 登录。
\n\n我尝试过的事情:
\n1。添加了 SHA-1 证书
\n2。添加了 SHA-256 证书
\n3。已填充 O-Auth 屏幕
\n4. 在 firebase 中启用了 GoogleSignIn
\n5。添加了支持电子邮件
目前仅在调试模式下进行测试。由于该应用程序目前处于初始阶段,我还不想构建发布版本。使用调试 SHA-1 和 SHA-256 指纹。
\n\nFuture<FirebaseUser> _signIn(BuildContext context) async {\nfinal GoogleSignInAccount googleUser = await _googleSignIn.signIn();\nfinal GoogleSignInAuthentication googleAuth =\n await googleUser.authentication;\n\nfinal AuthCredential credential = GoogleAuthProvider.getCredential(\n accessToken: googleAuth.accessToken, idToken: googleAuth.idToken);\n\nAuthResult userDetails =\n await _firebaseAuth.signInWithCredential(credential);\nProviderDetails providerInfo = \nProviderDetails(userDetails.user.providerId);\n\nList<ProviderDetails> providerData = List<ProviderDetails>();\nproviderData.add(providerInfo);\n\nUserDetails details = UserDetails(\n providerDetails: userDetails.user.providerId,\n userEmail: userDetails.user.email,\n userName: userDetails.user.displayName,\n photoUrl: userDetails.user.photoUrl,\n providerData: providerData);\n\nreturn userDetails.user;\n}\nRun Code Online (Sandbox Code Playgroud)\n\n我得到的错误
\n\n[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] …Run Code Online (Sandbox Code Playgroud)