如何验证一个Facebook用户的访问令牌上编程服务器端(Node.js的)? [英] How to verify a Facebook user's access token programmatically on the server-side (Node.js)?
问题描述
我有一个Facebook用户的访问令牌,我想验证这个访问令牌是否有效,即无论是已知的Facebook,目前有效的,等等...
I have an access token by a Facebook user, and I'd like to verify whether this access token is valid, i.e. whether it is known to Facebook, currently valid, and so on…
到目前为止,我已经采取了看看Facebook的的各种的API,基本上,我什么需要的是的用户的功能得到用户的细节组合,但对于用户标识由一个访问令牌(不是他/她的ID)。
So far, I have taken a look at the various APIs of Facebook, and basically, what I need is a combination of the User functionality to get the user's details, but for a user identified by an access token (not his / her ID).
我想,不知怎的,我需要处理访问令牌API ,但作为我完全新开发Facebook应用程序,我不知道从哪里开始。
I suppose that somehow I need to deal with the access token API, but as I am completely new to developing Facebook applications, I'm not sure where to start.
基本上,我无法想象,这应该是一个相当艰巨的任务。直觉上,我期望的东西,如:
Basically, I can not imagine that this should be a quite hard task. Intuitively I'd expect something such as:
GET http://graph.facebook.com/me?accessToken=$INSERT_TOKEN_HERE
请问像这样的东西存在吗?如果是的话,可以请你点我在正确的方向?即使在什么搜索(术语,例如,)一些提示可能会有所帮助。
Does anything like this exist? If so, can you please point me in the right direction? Even a few hints on what to search for (terms, e.g.) might be helpful.
顺便说一下,此请求外壳被从服务器发送的,而不是从浏览器
By the way, this request shell be sent from a server, not from the browser.
我不知道是否是重要的,但我使用Node.js的这一点。此外,如果有哪个可以抽象的REST调用走了一个现成的模块,这也可能是有益的,有趣的。
I don't know whether it is important, but I am using Node.js for this. Additionally, if there's a ready-made module which can abstract the REST calls away, this might also be helpful and interesting.
任何想法?
推荐答案
您可以检索通过发出GET请求到 debug_token
连接与特定的访问令牌中的信息。是这样的:
You can retrieve the information related to a particular Access Token by issuing a GET request to the debug_token
connection. Something like:
GET /debug_token?
input_token={input-token}&
access_token={access-token}
您可以得到关于它的更多信息,获取有关信息的令牌和调试参考。
You can get more information about it in the Getting Info about Tokens and Debugging reference.
这篇关于如何验证一个Facebook用户的访问令牌上编程服务器端(Node.js的)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!