flutter - PlatformException(popup_blocked_by_browser,从 GoogleAuth.signIn() 引发的异常
问题描述
PlatformException(popup_blocked_by_browser, Exception raised from GoogleAuth.signIn()
尝试使用 google_sign_in 颤振包通过 Google 登录时,我不断
尝试。这只发生在我使用 safari 时,它在 chrome 上很好。我想知道为什么它在第一次尝试时失败但在之后的尝试中起作用。如果我刷新浏览器,它会在第一次尝试时再次失败。
这是我使用 firebase auth 和 google 登录的功能
@override
Future<auth.User?> signInWithGoogle() async {
final GoogleSignInAccount? googleUser =
await _googleSignIn.signInSilently();
final GoogleSignInAuthentication? googleAuth =
await googleUser?.authentication;
if (googleAuth == null) {
return null;
}
final AuthCredential credential = GoogleAuthProvider.credential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
final UserCredential userCredential =
await _firebaseAuth.signInWithCredential(credential);
return auth.User(
uid: userCredential.user?.uid,
email: userCredential.user?.email,
);
}
解决方案
推荐阅读
- javascript - 多级json格式及javascript数据提取方法
- pandas-datareader - 在 python 中使用 yahoo 和 pandas_datareader 从不同市场获取市场数据
- php - PHP在xampp中不起作用,通过本地软管访问
- javascript - 如何使用带有定期更新和 React Hooks 的 Redux 处理状态?
- javascript - 您能否从 HTML 表生成 CSV 文件,并同时将该 CSV 文件上传到输入类型 =“文件”字段。不提示下载
- java - 使用 mysqldump 通过 ssh 备份 MYSQL 远程服务器数据库
- javascript - 如何将我在 Adobe Illustrator 中制作的图标上传到我的 HTML 文档?
- android-layout - 如何更改 MaterialFilePicker 屏幕方向?
- google-apps-script - VLookup 的 Google Script 版本(更有效的方法?)
- python - 根据 pandas 中的多个条件对 DataFrame 进行排序