来自服务器的API调用需要一个appsecret_proof参数 [英] API calls from the server require an appsecret_proof argument

查看:188
本文介绍了来自服务器的API调用需要一个appsecret_proof参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用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来说,可能会在没有秘密的情况下发出API请求.但是,如果我尝试使用Facebook Graph API Debugger中currentSession中的访问令牌,响应将与上面相同.

我不知道这是否与新的Android Facebook SDK有关,但是我的代码与示例中的代码基本相同.登录进展顺利,我获得了会话令牌,但是我无法发出任何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. /p>

但是,这是解决方法,而不是解决方法,因为我无法通过设置为Yes的选项来执行请求(在iOS facebook sdk中可能如此).

I can't make API requests with the Android Facebook SDK, or even get the user from the login callback - it always returns null.

Particularly, with the newMeRequest, I get the following error message:

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

Actually, it seems pretty obvious, because the flag is set to true in the Facebook app options. However, I know it is possible, for the mobile sdks, to make API requests without the secret. However, if I try to use the access token from the currentSession in the Facebook Graph API Debugger, the response will be the same as above.

I don't know if this is related to the new Android Facebook SDK, but my code is basically the same as in the examples. The login goes nicely and I get the session token but I can't make any API requests...

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();

解决方案

The only way that I was able to put it working, was by settings to No the App Secret proof for API calls in the advanced settings of the facebook App.

However, this is a fix, not a solve, since I wasn't able to do the request in the option set to Yes (as is possible in the iOS facebook sdk).

这篇关于来自服务器的API调用需要一个appsecret_proof参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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