简体   繁体   English

Firebase:Google OAuth2登录失败

[英]Firebase : Google OAuth2 signin fails

I have just released app in play store, but there is problem in google signin. 我刚刚在Play商店中发布了应用,但是Google登录存在问题。 If i directaly insall signed apk then google login work perfactly. 如果我直接安装了apk签名版,那么Google登录就可以正常工作了。 but when i download app from play store google login doesnt work. 但是,当我从Play商店下载应用程序时,Google登录不起作用。 It gives me below error. 它给了我下面的错误。

E/TokenRequestor: You have wrong OAuth2 related configurations, 
please check. Detailed error: UNREGISTERED_ON_API_CONSOLE

I already added debug and release sha1 to firebase console. 我已经添加了调试功能并将sha1发行到了Firebase控制台。 Please let me know if i missed anything. 如果我错过了任何事情,请告诉我。

Seems to be a configuration issue with Firebase, Google API console and your google-services.json file. 似乎是Firebase,Google API控制台和google-services.json文件的配置问题。

You need to know that the release APK and debug APK have different SHA1 and different API keys for Google Services. 您需要知道release APKdebug APK具有不同的SHA1不同的Google Services API密钥 So you need to add both of them in inside Firebase Project Setting. 因此,您需要在Firebase项目设置中将它们都添加。

After adding both you need to redownload the google-services.json file and put it in the right place of your project. 两者都添加后,您需要重新下载google-services.json文件并将其放在项目的正确位置。 Create a fresh release build with your keystore and publish you app once again in Google Play Store. 使用您的密钥库创建一个新的发行版本,然后再次在Google Play商店中发布您的应用。

Should work. 应该管用。

This issue with the wrong (not added) SHA1 in google-services.json google-services.json中的 SHA1错误(未添加)的问题

To solve this you need to add SHA1 for publish apk as well in firebase console project. 为了解决这个问题,您还需要在firebase控制台项目中添加SHA1以便publish apk

  1. generate SHA1 for debug 生成SHA1进行调试

    keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore keytool -exportcert -list -v -alias androiddebugkey -keystore〜/ .android / debug.keystore

  2. generate SHA1 for release 生成SHA1以便发布

    keytool -exportcert -list -v -alias your-key-name -keystore path-to-production-keystore keytool -exportcert -list -v -alias your-key-name -keystore生产密钥库的路径

  3. Add SHA1 for publish apk 添加SHA1以发布apk

    I went to my Release Management tab , then scrolled down to App Signing , and found the SHA-1 there. 我转到“ 发布管理”选项卡 ,然后向下滚动到“ 应用签名” ,并在那里找到SHA-1

After adding all these SHA-1 in firebase console. 在Firebase控制台中添加所有这些SHA-1之后。 you need to again download google-services.json and put in android project. 您需要再次下载google-services.json并放入android项目。 generate signed apk again and publish it. 再次生成签名的apk并将其发布。 It will works. 它将起作用。

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

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