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链接
重现的步骤:
启动应用程序使用Facebook登录验证FB配置文件.
取消安装该应用并重新安装.
现在尝试使用Facebook登录.
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):
Release click Setup > App integrity

App signing certificate copy the SHA-1 certificate fingerprintOutput (base64)My Apps > Your App Name)Settings > BasicKey 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商店并从商店安装应用时,它会显示相同的登录失败错误。修复方法如下:
小智 11
我也面临这个问题。在Facebook上更新您的密钥哈希
小智 10
keytool -list -printcert -jarfile yourapkname.apkMD5: 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
解决方案是 -------------- 如果您在手机中安装了 facebook 应用程序,请设置 LoginBehavior loginButton.setLoginBehavior(LoginBehavior.WEB_ONLY);
我通过替换密钥哈希解决了同样的问题,
如何生成用于发布的密钥哈希。打开 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)
按照步骤进行操作并在最后说。"Hurrey"
完成facebook在android中集成的全部流程。
从 Android创建Hashkey(SHA1 密钥)
然后从“调试”或“发布”变体中选择 SHA1 密钥。
然后打开以下链接:http://tomeko.net/online_tools/hex_to_base64.php并粘贴 SHA1 密钥。 在此输入链接描述
选择行尾有“=”符号的输出(base64)键。
打开您的Developer Facebook网站并选择集成应用程序,然后转到 -> 设置 -> 基本 -> 密钥哈希。在此处添加这些新密钥。

| 归档时间: |
|
| 查看次数: |
31594 次 |
| 最近记录: |