微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Flutter Firebase 身份验证在 Google Play 中不起作用

如何解决Flutter Firebase 身份验证在 Google Play 中不起作用

我的 Flutter 应用程序中有 firebase 身份验证服务。它正在模拟器和真实设备上工作(在调试时)。但是当我在 google play 上发布它时,无论是 alpha 测试还是发布版本,它都不起作用。

Main.dart

        StreamProvider(
      create: (context) => context.read<AuthenticationService>().authStateChanges,)

AuthService

  final FirebaseAuth _firebaseAuth;
  AuthenticationService(this._firebaseAuth);
  Accesstoken accesstoken;
  Stream<User> get authStateChanges => _firebaseAuth.idTokenChanges();

AuthService 中的 SignedIn 方法

  Future<String> signIn({String email,String password}) async {
    try {
      await _firebaseAuth.signInWithEmailAndPassword(email: email,password: password);
      String uid = await FirebaseAuth.instance.currentUser.uid;

      return "Signed in";
    } on FirebaseAuthException catch (e) {
      return e.message;
    }
  }

登录.dart

  var login = await context.read<AuthenticationService>().signIn(email: mailController.text,password: sifreController.text);

解决方法

可能是您忘记将 Google Play 指纹放入 Firebase 应用配置中。

如果您的应用中不存在 Google Play 指纹,则用户无法连接到 Firebase 服务。

您可以在设置 -> 应用签名菜单中找到您的 Google Play 指纹。 见下图

enter image description here

然后,您应该将它们添加到 Firebase 应用的 android 设置中。

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。