forum

Home / DeveloperSection / Forums / Should I pass access token when using FB.api()?

Should I pass access token when using FB.api()?

Samuel Fernandes435920-May-2013
Hi!

I'm just a little confused as to how to pass my access token into FB.api() when making requests for protected things.

I'm getting my app to login and authenticate fine, but how do I use FB.api() with the access token I have?

app.accessToken = response.authResponse.accessToken; // This is a valid access token.

FB.api('/me/friends?access_token='+app.accessToken, {fields: 'name,id,location,picture,installed'}, function(response) {
    console.log(response);
});
Is that the correct way to pass in the access token to FB.api()?

In this case, my response comes back with the friends name,id,location,picture but it doesn't seem to have the 'installed' data as that is protected.

Am I doing this right? Please Guide me!

Your help is greatly appreciated.


Updated on 20-May-2013

Can you answer this question?


Answer

1 Answers

Liked By