views:

42

answers:

1

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;
    }

});
+1  A: 

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.

Yuliy
Got it. I guess I should just do this from the server from the start.
Phil_Ken_Sebben