开发者

receive application access token from Facebook

开发者 https://www.devze.com 2023-01-22 03:57 出处:网络
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.facebo

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 li开发者_运维百科ke 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;
    }

});


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消