登录错误:登录此应用程序时出错.请稍后再试

Nav*_*r M 35 android facebook facebook-graph-api facebook-login

我收到了这个错误.当我尝试使用Facebook登录我的应用程序时.当我第一次进行身份验证时,它将正常工作.在我取消了我的应用程序并且现在尝试使用Facebook登录后,我收到此错误.

另一个问题:在device1中进行身份验证并尝试在设备2上使用facebook登录时也会出现同样的错误.

解决方案我发现:当我从Facebook应用程序设置中删除应用程序身份验证时,它正在上面的场景中运行,但这不是一个很好的解决方案,我们可以告诉用户如何执行此操作?

btnFbLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(accessToken != null) {
                    boolean expires = accessToken.isExpired();
                    if(!expires) {
                        performFbLoginOrSignUp(accessToken);
                    }
                } else {
                    LoginButton loginButton = (LoginButton) findViewById(R.id.login_button);
                    callbackManager = CallbackManager.Factory.create();

                    if (loginButton != null) {
                        loginButton.setReadPermissions("public_profile", "email", "user_friends");

                        if (CommonUtil.isConnectingToInternet(LoginActivity.this)) {
                            loginButton.performClick();

                            loginButton.setPressed(true);

                            loginButton.invalidate();

                            loginButton.registerCallback(callbackManager, mCallBack);

                            loginButton.setPressed(false);

                            loginButton.invalidate();
                        } 
                    }
                }
            }
        });
Run Code Online (Sandbox Code Playgroud)

错误页面

在Facebook的例子中也有一个问题: Facebook示例的GitHub链接

重现的步骤:

  1. 启动应用程序使用Facebook登录验证FB配置文件.

  2. 取消安装该应用并重新安装.

  3. 现在尝试使用Facebook登录.

  4. 将发生上述错误.因为我们已经过身份验证所以需要访问fb配置文件.但在这里我们面临着这个问题.
  5. 这里已经过身份验证的页面没有显示.
  6. 我正在使用Native FB app与设备Xiaomi Redmi Note 3

Taf*_*fel 47

ANSWER

Just throwing this out there for people still experiencing this issue. The hash I created through the keytool was somehow incorrect. I fixed it by doing the following:

If you already uploaded your app to the playstore and enabled "app signing by Google Play" there is a solution (at least this worked for me):

  1. Login into the Google Play Console
  2. Click on the app you want the hash from
  3. Now, open the navigation on the left hand side
  4. Under Release click Setup > App integrity Google Play 控制台中的导航抽屉
  5. Under App signing certificate copy the SHA-1 certificate fingerprint
  6. Go to http://tomeko.net/online_tools/hex_to_base64.php
  7. Paste the SHA-1 in the first field
  8. Copy the text in input field under Output (base64)
  9. Now open developer.facebook.com/apps
  10. Navigate to the dashboard of your app (My Apps > Your App Name)
  11. On the left side navigate to Settings > Basic
  12. Paste the Base64 text here under Key Hashes 在此处输入图片说明

That should fix the issue.


UPDATE

The steps above should still fully work.

But if you do not want to paste your key on that website, here is an alternative to step 6,7,8 below:

here's a oneliner Node.js command to do the same:

node -e 'console.log(Buffer.from(process.argv[1].split(":").map(hex => parseInt(hex, 16))).toString("base64"))' '5E:8F:16:06:2E:A3:CD:2C:4A:0D:54:78:76:BA:A6:F3:8C:AB:F6:25'
Run Code Online (Sandbox Code Playgroud)

credits: mifi



Sum*_*diq 15

由于无效的哈希键而发生错误。

我们可以使用以下命令创建哈希密钥,并在“设置”->“基本”->“ Android HashKeys”下在此处进行更新

keytool -exportcert -alias ADD_RELEASE_KEY_ALIASE_HERE -keystore ADD_UR_KEYSTORE_PATH_HERE | openssl sha1 -binary | openssl base64
Run Code Online (Sandbox Code Playgroud)

如果需要,可以使用以下命令找到密钥库的发布密钥别名:

keytool -list -keystore ADD_UR_KEYSTORE_PATH_HERE
Run Code Online (Sandbox Code Playgroud)

我也遇到了类似的问题,例如使用上述HashKey,如果我直接将发行版APK安装到设备上,登录就可以正常工作,但是当我将APK上传到Play商店并从商店安装应用时,它会显示相同的登录失败错误。修复方法如下:

  1. 在此处转到发布管理
  2. 选择发布管理?->应用程序签名
  3. 您可以以十六进制格式的应用签名证书看到SHA1密钥。
  4. 以十六进制格式复制SHA1并将其转换为base64格式,您可以使用此  链接  在没有SHA1:部分的情况下做到这一点。
  5. 转到Facebook开发者控制台,并在设置->基本->密钥哈希中添加密钥(转换为base 64后)。

  • 我的应用程序尚未发布,仍在开发中。我正在创建发布版本,还创建发布密钥库并使用发布密钥库生成 sha1 哈希密钥。但如果安装了 Facebook 应用程序,并且网络登录对话框中没有 Facebook 应用程序,我仍然无法登录。请帮我解决它。@SumiSadic (2认同)

小智 11

我也面临这个问题。在Facebook上更新您的密钥哈希

  • 但对我来说还没有解决。检查此链接 https://developers.facebook.com/bugs/297086380683342/ 这里有很多成员面临同样的问题。我提供了重现步骤,请按照步骤重现。 (2认同)

小智 10

  1. 生成.apk文件
  2. 打开 .apk 文件存在的终端
  3. 请记住,您必须生成两个单独的 SHA1 密钥以用于发布和调试。例如,只需使用 debug.apk 和 release.apk 运行以下命令
  4. 跑步keytool -list -printcert -jarfile yourapkname.apk
  5. 你会得到

MD5: 00:00:A0:00:00:00:72:00:00:B9:00:00:00:3D:00:00

SHA1: 00:00:94:00:67:00:FA:00:4E:00:CE:80:00:1A:00:00:00:00:00:00

SHA256: 00:00:00:34:00:00:00:00:00:00:00:00:00:00:00:00:56:00:F5:00:00:49:00:4A: 00:00:00:00:00:00:00:00

  1. 复制SHA1打开http://tomeko.net/online_tools/hex_to_base64.php
  2. 在十六进制字符串中过去,您的密钥哈希将在输出中(base64)
  3. 复制您的密钥哈希并添加到developers.facebook.com上的应用程序设置中

  • 谢谢@Rasheed Qureshi,尝试了所有方法,但你的方法救了我。 (3认同)

Dee*_*mar 7

在此处输入图片说明

在此处输入图片说明FnnK.jpg

解决方案是 -------------- 如果您在手机中安装了 facebook 应用程序,请设置 LoginBehavior loginButton.setLoginBehavior(LoginBehavior.WEB_ONLY);


Suj*_*mar 6

我通过替换密钥哈希解决了同样的问题,

如何生成用于发布的密钥哈希。打开 Chrome 浏览器控制台将十六进制映射密钥转换为 Base64

从 Google Play 控制台复制 SHA1 密钥。

> btoa('a1:43:d4:27:c8:04:rr:fr:2g:3b:tg:b5:et:c1:4a:1t:fr:f5:54:5f'.split(':').map(hc => String.fromCharCode(parseInt(hc, 16))).join(''))
< "g5fGIBgB6noFO9ur78BdEr73KG6="
Run Code Online (Sandbox Code Playgroud)


Nik*_*the 6

按照步骤进行操作并在最后说。"Hurrey"

  1. 完成facebook在android中集成的全部流程。

  2. 从 Android创建Hashkey(SHA1 密钥)

    • 步骤: 转到 Android studio 屏幕左侧,双击该选定选项。 在此输入图像描述
  3. 然后从“调试”“发布”变体中选择 SHA1 密钥。

    • 如果您想在实时应用程序中执行操作,请使用“release” Variant。
    • 否则,请使用“调试”变体的 SHA1 密钥。
  4. 然后打开以下链接:http://tomeko.net/online_tools/hex_to_base64.php并粘贴 SHA1 密钥。 在此输入链接描述

  5. 选择行尾有“=”符号的输出(base64)键。

  6. 打开您的Developer Facebook网站并选择集成应用程序,然后转到 -> 设置 -> 基本 -> 密钥哈希。在此处添加这些新密钥。 在此输入图像描述


归档时间:

查看次数:

31594 次

最近记录:

6 年,6 月 前