从 Facebook 接收应用程序访问令牌
我正在尝试学习如何从 Facebook 获取我的应用程序的应用程序访问令牌。
我正在根据此处指定的数据(http: //developers.facebook.com/docs/authentication/#client_credentials)。
我似乎得到了响应( access_token = 'my_app_id|'+the_app_token ),但 firebug 发送了一个错误 => '我得到的响应'+'未定义'。感觉我在这里错过了一些非常简单的东西?我怎样才能避免这个错误并得到响应?
params = {};
params['grant_type']= 'client_credentials'
params['client_id'] =app_id;
params['client_secret'] = client_secret;
$.ajax({
url: 'https://graph.facebook.com/oauth/access_token',
type:'GET',
dataType: 'jsonp',
data:params,
success: function(response){
resp = response;
}
});
I'm trying to learn how to get an application access token from Facebook for my app.
I'm sending a jquery reguest (in the firebug console) based on the data specified here (http://developers.facebook.com/docs/authentication/#client_credentials).
I seem to get the response ( access_token = 'my_app_id|'+the_app_token ) but firebug sends a error => 'the response i get'+'is not defined'. feel like I'm missing something very simple here? how can I avoid this error and get the response?
params = {};
params['grant_type']= 'client_credentials'
params['client_id'] =app_id;
params['client_secret'] = client_secret;
$.ajax({
url: 'https://graph.facebook.com/oauth/access_token',
type:'GET',
dataType: 'jsonp',
data:params,
success: function(response){
resp = response;
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为这是受支持的( /oauth/access_token 端点是由服务器而不是客户端浏览器请求的),但好消息是您可以只发送 appid + '|' + client_secret 代替应用程序访问令牌,它将起作用。
I don't think this is supported (the /oauth/access_token endpoint is meant to be requested by a server, not a client's browser), but the good news is that you can just send appid + '|' + client_secret in place of the app access token and it'll work.