开发者

Getting Access Token from cookies to use with Facebook Graph API

开发者 https://www.devze.com 2023-02-13 06:27 出处:网络
Assuming I have a user logged in to Fac开发者_如何学Cebook (Cookies are saved in the browser\'s cache), what is the simplest way to get its access token?

Assuming I have a user logged in to Fac开发者_如何学Cebook (Cookies are saved in the browser's cache), what is the simplest way to get its access token? I'm experimenting with Facebook's Graph API, and I don't want to bother with creating an application in order to get access tokens (at least not now).

If I remember correctly, a few days ago I went to http://graph.facebook.com/me on my browser (while being logged in), which redirected me to http://graph.facebook.com/me?access_token=..., but now I get that instead (and no redirection):

{  
      "error":      {  
      "type":    "OAuthException",  
      "message": "An active access token must be used to query information about the current user."  
   }  
}

Unfortunately, I couldn't rely on previously answered questions, since I strongly believe things changed very recently.


All the docs you're going to need are here: https://developers.facebook.com/docs/authentication/

If you just want a single access token for yourself to test some things in the API, you could use the Graph API Explorer ( https://developers.facebook.com/tools/explorer ) to generate an access token for you for that app and copy/paste it to your code.

Be sure to include the 'offline_access' permission to get a token which won't quickly expire.


Simply you can't!
You need to create an application to be able to generate an access_token (after a successful authentication/authorization). More about this here.

0

精彩评论

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

关注公众号