user3392740
user3392740

Reputation: 445

Facebook long term access tokens using the Javascript sdk

I have obtained a short term access token using the simple Javascript SDK. Now, to obtain the long term access token, I can use ajax or make a simple REST call in Javascript.

 $.ajax({
            url: 'https://graph.facebook.com/oauth/access_token,
            type: 'GET',
            data: 'grant_type=fb_exchange_token&client_id=' + appID + '&client_secret=' + appSecret + '&fb_exchange_token=' + short_term_access_token,
            success: function(response) { alert(reponse); }
        });

But is there an API with the Facebook Javascript SDK to obtain the long term access token in exchange for the short term one?

Upvotes: 1

Views: 692

Answers (1)

Ellen Kenne
Ellen Kenne

Reputation: 106

You need to pass the token to your server-side code to do the exchange token. Don't put your app secret in client-side, it's not safe!!

Upvotes: 2

Related Questions