How do I get the Facebook access token when using the JavaScript API? - Stack Overflow

I need to link to the cover picture of an album on Facebook. This method works: img.src = "<al

I need to link to the cover picture of an album on Facebook. This method works:

 img.src = "/<album_id>/picture?access_token=' + 
           FB._session.access_token;

But using FB._session.access_token doesn't look right...is there a better way? A pointer to the relevant docs would be nice, I couldn't find it myself.

I can't make FB.api() work for this, probably because the response is a redirect to the URL of the actual image data.

I need to link to the cover picture of an album on Facebook. This method works:

 img.src = "https://graph.facebook./<album_id>/picture?access_token=' + 
           FB._session.access_token;

But using FB._session.access_token doesn't look right...is there a better way? A pointer to the relevant docs would be nice, I couldn't find it myself.

I can't make FB.api() work for this, probably because the response is a redirect to the URL of the actual image data.

Share Improve this question asked Jan 18, 2011 at 10:05 ChopmoChopmo 1,4161 gold badge10 silver badges18 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

You could have a look here : How to get access token from FB.login method in javascript SDK

FB.login(function (response) {
    if (response.session) {
        var access_token = response.session.access_token;
        alert(access_token);
    } else {
        alert('User is logged out');
    }
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745580993a4634253.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信