开发者

How to get current access_token in graph api?

i working on graph api in python in appengine , and i want to get access_token to to be able to create a new album

  base_url = "https://graph.facebook.com/me/albums"
    encoded_album_name= urllib.quote("refacingme.appspot.com")
    name="&name="+encoded开发者_StackOverflow中文版_album_name
    type="&type=post"
    access_token="&access_token="+str(fb.uid)    
    opener = urllib2.build_opener()
    opener.addheaders = [('Accept-Language', 'en-US,en;q=0.8')]
    url = "%s%s%s%s" % (base_url,access_token,type,name)


The best way I've found to get the access token is to use the get_user_from_cookie method of the facebook python sdk. There's an example usage in the comments of the file:

https://github.com/facebook/python-sdk/blob/master/src/facebook.py

This requires that the cookie gets set from the facebook javascript sdk in the browser. You may also need to request permissions (also done through the javascript sdk).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜