标签: hummingbird

Flutter Web Google 登录

我尝试在 Flutter Web 中使用 Google 实现登录。我使用GoogleSignn 4.1.1Firebase Auth 0.15.4。我没有收到任何错误消息。它只是不弹出。

  • 我在 Firebase(添加的依赖项)中注册了 Web 应用程序,甚至添加了<meta>带有google-signin-client_id
  • 当我在 Android 上运行 Firebase Auth with Google 时它可以工作
  • 我还在Web 中从 GoogleSignIn运行了示例应用程序。它也不会弹出。

这是我的登录代码(适用于 Android)

    final FirebaseAuth _auth = FirebaseAuth.instance;
    FirebaseUser user = await _auth.currentUser();
    if (user != null) {
      log.d('alreadyLoggedIn');
    } else {
      final GoogleSignIn _googleSignIn = GoogleSignIn(clientId: Constants.GOOGLE_SIGN_IN_CLIENT_ID);
      final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
      final GoogleSignInAuthentication googleAuth =
          await googleUser.authentication;
      final AuthCredential credential = GoogleAuthProvider.getCredential(
        accessToken: googleAuth.accessToken,
        idToken: …
Run Code Online (Sandbox Code Playgroud)

google-authentication firebase-authentication flutter flutter-web hummingbird

7
推荐指数
1
解决办法
4242
查看次数