Just a query about the access_token [duplicate]

两盒软妹~` 提交于 2019-12-26 04:21:50

问题


Possible Duplicate:
How to access fb access token form server running program ( python )

I have made a app that allow me to login and store the fbuid and some other things as i'm just test things out. I have started to make a php commandline program that also uses the php-sdk as my web app does. The only problem is that as the php commandline program runs outside the browser it does not have access to the session to pickup the access_token which makes the program display 0 for getuser. I have thought that storing the access_token in the db as well as the others, and fetching this from the db and setting it, then the program should display the user as well as have access to the Graph API. Then how could it check if the access_token as changed if i'm not logged in through the web app which it can not change the access_token due to there's no auth interaction to the command program.

Thanks


回答1:


Having an access_token does not mean the PHP SDK can automatically extract the user id from it. If you want your comand line script to know the user, you’d have to make a request to /me using the access token first. (After that, getUser will still not work, but you know the user id and can put it into your API calls manually if necessary.)

And for checking the access_token for validity, see https://developers.facebook.com/docs/howtos/login/debugging-access-tokens/#step1



来源:https://stackoverflow.com/questions/13010705/just-a-query-about-the-access-token

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!