我无法使用Android Facebook SDK发出API请求,甚至无法从登录回调中获取用户-它始终返回null。

特别是,通过newMeRequest,我得到以下错误消息:

{ "error": {
 "message": "API calls from the server require an appsecret_proof argument",
 "type": "GraphMethodException",
 "code": 100   } }

实际上,这似乎很明显,因为在Facebook应用程序选项中将标志设置为true。但是,我知道对于移动sdks来说,可能会在没有 secret 的情况下发出API请求。但是,如果我尝试使用Facebook Graph API Debugger中currentSession的访问 token ,则响应将与上面相同。

我不知道这是否与新的Android Facebook SDK有关,但是我的代码与示例中的代码基本相同。登录进展顺利,我获得了 session token ,但是我无法发出任何API请求...
loginButton.setUserInfoChangedCallback(new LoginButton.UserInfoChangedCallback() {
    @Override
    public void onUserInfoFetched(GraphUser user) {
        graphUser = user;
    }
});


Request.newMeRequest(currentSession, new Request.GraphUserCallback() {
    @Override
    public void onCompleted(GraphUser user, Response response) {
    }
    }
}).executeAsync();

最佳答案

我能够使其起作用的唯一方法是通过在Facebook App的高级设置中将No设置为App Secret proof for API calls

但是,这是一个解决方法,而不是解决方法,因为我无法在设置为Yes的选项中进行请求(这在iOS facebook sdk中可能)。

10-07 19:25
查看更多