只是有关access_token的查询 [英] Just a query about the access_token

查看:71
本文介绍了只是有关access_token的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
如何访问正在运行的程序的fb访问令牌(python)

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

我制作了一个应用程序,可以让我登录并存储fbuid和其他一些内容,因为我只是在测试这些内容.我已经开始制作一个PHP命令行程序,该程序也像我的Web应用程序一样使用php-sdk.唯一的问题是,由于php命令行程序在浏览器外部运行,因此它无权访问该会话来拾取access_token,这会使该程序为getuser显示0.我以为将access_token和其他数据库都存储在数据库中,并从数据库中获取并设置数据库,然后程序应显示用户以及对Graph API的访问权限.然后,如果我没有通过Web应用程序登录,那么如何检查access_token是否已更改,由于没有对命令程序的身份验证交互,它不能更改access_token.

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.

谢谢

推荐答案

拥有access_token并不意味着PHP SDK可以自动从中提取用户ID.如果您想让指令行脚本认识用户,则必须先使用访问令牌向/me发出请求. (在那之后,getUser仍然无法使用,但是您知道用户ID,并且可以在必要时手动将其放入API调用中.)

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.)

要检查access_token的有效性,请参见 https: //developers.facebook.com/docs/howtos/login/debugging-access-tokens/#step1

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

这篇关于只是有关access_token的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆