“发生错误”当用Facebook的android sdk进行身份验证时 [英] "An error's occurred" when authenticating with Facebook's android sdk

查看:105
本文介绍了“发生错误”当用Facebook的android sdk进行身份验证时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在验证用户(或尝试)与我一直在使用的Android应用程序,我从Facebook对话框获得的所有内容是发生错误,没有关于错误的详细信息。没有任何例外被扔给我追逐或任何类型的东西。我遵循了 http://developers.facebook.com/docs/guides/mobile /#android 创建我的登录对话框。

I'm authenticating user's (or trying to) with my android app that I've been working on and all I get from the facebook dialog is that an error has occurred with no details as to what the error is. There are not exceptions being thrown for me to chase or anything of the sort. I've followed http://developers.facebook.com/docs/guides/mobile/#android to create my login dialog.

该页面说使用新的Facebook(YOUR_APP_ID);这导致错误,我也尝试过api密钥,但它给了同样的事情。
除了敬酒之外,我没有做任何其他事情,但是直到我按回车键才能离开Facebook对话框,我甚至没有收到回复。

The page says use new Facebook("YOUR_APP_ID"); which results in the error, I've also tried the api key but it gives the same thing. I'm not doing anything else except toasting but I don't even get a response in the callback until I hit the return key to leave the facebook dialog

public class Base {
private Facebook fb;

    public Base() {
        fb = new Facebook("app_id_here");
    }

    public void onCreate(Bundle b) {
        super.onCreate(b);
    }

    private void doLogin() {
        fb.authorize(this, new DialogListener() {
            public void onComplete(Bundle values) {
                Toast.makeText(getApplicationContext(), values.toString(),
                        Toast.LENGTH_LONG).show();
            }
            public void onFacebookError(FacebookError error) {
                Toast.makeText(getApplicationContext(), error.getMessage(),
                        Toast.LENGTH_LONG).show();

            }

            public void onError(DialogError e) {
                Toast.makeText(getApplicationContext(), e.getMessage(),
                        Toast.LENGTH_LONG).show();
            }

            public void onCancel() {
                Toast.makeText(getApplicationContext(),
                        "You must be registered and signed in to perform that action",
                        Toast.LENGTH_LONG).show();

            }
        });
    }

    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        fb.authorizeCallback(requestCode, resultCode, data);
    }
}

任何想法为什么会给出错误或哪里/我如何找到导致错误的原因
PS我还在FB应用程序设置页面的移动设备下添加了密钥哈希,并且这与在使用Facebook SDK登录失败的无效密钥错误我已经尝试了在那里的建议。它不工作

Any idea why this will be giving an error or where/how I can find what's causing the error P.S I've also added the key hash under "Mobile and Devices" on the FB app settings page and this isn't the same problem as found over at Login failed invalid key error with Facebook SDK I've tried the suggestions over there. It doesn't work

推荐答案

我也面临这个问题。首先,我需要知道你在Facebook应用程序中输入的键值哈希值,如果它是' ga0RGNYHvNM5d0SLGQfpQWAPGJ8 = ',那就是问题。我想你进入

I also faced this problem. First of all I need to know which Key Hash value you entered on facebook app if it is 'ga0RGNYHvNM5d0SLGQfpQWAPGJ8=' then that is the problem. I think you entered


keytool -exportcert -alias androiddebugkey -keystore
〜/ .android / debug.keystore | openssl sha1 -binary | openssl base64

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

这一个在终端上,您输入了自己的密码来生成密钥哈希。如果你这样做,请尝试做以下事情,你也可以在终端上输入上面的命令(我正在使用UBUNTU(linux),键入与你使用的操作系统相对应的命令),而输入密码为android 即可。这次你会得到一个不同的哈希值。复制该值并将其保存为您的Facebook应用程序的键哈希值。之后检查它是否正常工作。对我而言当我们使用调试键时会出现这种情况。毕竟,当您即将在Android市场上发布此应用程序时,您将不得不再次根据您使用的私钥更改密钥哈希值。尝试这可能会帮助你。

this one on the terminal and you entered your own password to generate the key hash. if you done that please try do the following things also you enter the above command on terminal(I am using UBUNTU(linux). You type the command corresponding to which OS you are using) and enter the password as 'android'. This time you will get a different hey hash value. Copy that value and save it as the key hash value for your facebook app. After that check it is working or not. For me it worked. This will occur when we are using the debug key. After all this when you are about to publish this application on the Android market you will have to again change the key hash value according to the private key you are using. Try this may be this will help you.

这篇关于“发生错误”当用Facebook的android sdk进行身份验证时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆