简体   繁体   English

Firebase 带有 OTP 的电话身份验证在发布版本中不起作用

[英]Firebase Phone authentication with OTP not working in release build

I am using Firebase SDK in android app for phone auth OTP verification.我在 android 应用程序中使用 Firebase SDK 进行电话身份验证 OTP 验证。 This is working fine on debug builds but not on release builds.这在调试版本上运行良好,但在发布版本上却不行。

  1. Added my debug SHA-1 finger print in firebase project.在 firebase 项目中添加了我的调试 SHA-1 指纹。
  2. Added my release certification SHA-1 fingerprint in firebase project.在 firebase 项目中添加了我的发布认证 SHA-1 指纹。
  3. I haven't released/published the build into google play store yet.我还没有将构建发布/发布到谷歌游戏商店。

Thanks in advance提前致谢

For debug keys: Open your project in android studio > Click on Gradle (In the right panel) > Click on Your Project > Click on Tasks > Click on android > Double Click on signingReport对于调试密钥:在 android 工作室中打开您的项目 > 单击 Gradle(在右侧面板中)> 单击您的项目 > 单击任务 > 单击 android > 双击签名报告

For release keys: Use this command to generate release keys: keytool -list -v -keystore "your jks file path " -alias "key name"对于发布密钥:使用此命令生成发布密钥: keytool -list -v -keystore "your jks file path" -alias "key name"

Add jks path and key name and run this command in android studio terminal.添加 jks 路径和密钥名称并在 android 工作室终端中运行此命令。

OR或者

You can also get SHA1 and SHA- 256 from google play console.您还可以从 google play 控制台获取 SHA1 和 SHA-256。 Go to Play store Console > Your project > Release > Setup > App signing. Go 到 Play 商店控制台 > 您的项目 > 发布 > 设置 > 应用签名。

  1. Copy both debug and release SHA1 and SHA- 256 keys and paste in firebase console.复制调试和发布 SHA1 和 SHA-256 密钥并粘贴到 firebase 控制台中。
  2. Update your firebase-auth version to 20.0.1 then you also need to configure safetynet in your project.将您的 firebase-auth 版本更新为 20.0.1,然后您还需要在项目中配置安全网。 For more info check this link有关更多信息,请查看此链接
  3. Make sure PHONE AUTHENTICATION is enabled.确保已启用电话验证。 Go to Firebase console -> Authentication -> Sign-in Methods. Go 到 Firebase 控制台 -> 身份验证 -> 登录方法。
  4. After adding keys, download updated google-services.json and add in your project.添加密钥后,下载更新的 google-services.json 并添加到您的项目中。
  5. Clean project and then rebuild project.清理项目,然后重建项目。
  6. Test your app again (In order to prevent abuse the firebase phone authentication wont work in emulator so test on real device).再次测试您的应用程序(为了防止滥用 firebase 手机身份验证在模拟器中不起作用,因此在真实设备上进行测试)。

Check if you have completed all the above steps in your proejct.检查您是否已在项目中完成上述所有步骤。 If your app is live on play store make sure your firebase project have both debug & release SHA1,SHA-256 key in your firebase console.如果您的应用在 Play 商店中上线,请确保您的 firebase 项目在您的 firebase 控制台中同时具有调试和发布 SHA1、SHA-256 密钥。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM