首页 > 解决方案 > flutter firebase phone auth error a security net token was pass but no matching sha-256 was registered in the firebase console

问题描述

我在 firebase 上注册了 sha-1 release 和 debug key,我都做了 firebase 注册教程

但是当我调用 verifyPhoneNumber(); 时收到此消息;

在验证失败:(AuthException异常){exception.message};

This app is not authorized to use Firebase Authentication.
Please verify that the correct package name and SHA-1 are configured
 in the Firebase Console.
[ A safety_net_token was passed, but no matching SHA-256 was registered in the 
Firebase console.
Please make sure that this application's packageName/SHA256 pair is registered in
 the Firebase Console ] 

我以为如果我注册 sha1 就不需要注册 sha256 但它是这样说的

这是什么原因,我该如何解决这个问题?

标签: firebaseflutterfirebase-authenticationsha256

解决方案


解决方案是:

  1. 按“Win + R”并运行“resmon.exe”。
  2. 转到 CPU 选项卡并在 Associated Handles 搜索栏中搜索“build”。
  3. 右键单击“java.exe”进程,然后单击END PROCESS。
  4. 运行flutter clean以清理您的项目依赖项。
  5. 从 firebase 下载新的 google-services.json 文件并将其添加到 Flutter 项目的 app 文件夹中。
  6. 再次运行pub get以获取所有依赖项。
  7. 运行您的项目。

那你就可以走了。它对我有用。


推荐阅读