android - Flutter - 我无法使用 Google 帐户登录
问题描述
当您单击该按钮时,会出现一个窗口,其中包含我选择的 Google 帐户,而不是切换到新页面,而是出现错误。截图错误
我的代码:
import 'package:google_sign_in/google_sign_in.dart';
GoogleSignIn googleAuth = GoogleSignIn();
final FirebaseAuth _fAuth = FirebaseAuth.instance;
final GoogleSignIn _gSignIn = GoogleSignIn();
Future<FirebaseUser> _signInGoogle() async {
GoogleSignInAccount googleSignInAccount = await _gSignIn.signIn();
GoogleSignInAuthentication authentication = await googleSignInAccount.authentication;
var signInWithGoogle = signInWithGoogle;
FirebaseUser user = await _fAuth.signInWithGoogle(
idToken: authentication.idToken,
accessToken: authentication.accessToken
);
return user;
}
onPressed:() async {
await _signInGoogle();
Navigator.of(context).pushReplacementNamed('/home_screen');
}
解决方案
您是否添加了您的 SHA 指纹?
请检查我的答案以了解如何执行此操作:https ://stackoverflow.com/a/54479992/679553
推荐阅读
- spring - 如何为 spring boot2 应用程序设置特定于环境的 log4j2 配置
- design-patterns - 用于确定对对象采取的操作的命令或审核集合
- javascript - 在 Chrome 隐身模式中未触发 onbeforeunload 事件
- ruby-on-rails - Rails ActiveStorage 从 URL 获取图像,然后在第一次点击时调整大小并上传
- c - 我正在尝试创建 ac 程序,该程序将不断从标准输入获取输入,直到输入退出
- javascript - 我在尝试运行“npx react-native run-android”时遇到错误
- r - 导入具有第一行特定单词的多个文本文件
- sql - 关于在SSIS包中向数据源和目标添加列的问题
- java - 将文本添加到pdf?
- python - 如何在 Python 中打印到 .txt 文件的下一行