如何验证Facebook访问令牌? [英] how to verify facebook access token?

查看:145
本文介绍了如何验证Facebook访问令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

服务器只有这样做;只需检查任何访问令牌的有效性。

there's only thing that server have to do; just check any access token's validity.

客户端发送到服务器用户标识和访问由FB.getLoginStatus获取的令牌。

clients send to the server user id and access token obtained by FB.getLoginStatus.

如我所料,将有任何url检查访问令牌的有效性,如

As I expected, there would be any url that checks access token's validity, like

http://xxx.facebook.com/access_token?=xxxxxxxxxxxxxxxxxxxxxxxxxx

返回是否可用。

或者是否有任何API(服务器端)?

or is there any API(server side) for that?

推荐答案

正式支持的方法是:

GET graph.facebook.com/debug_token?
     input_token={token-to-inspect}
     &access_token={app-token-or-admin-token}

请参阅

See the check token docs for more information.

一个示例回复是:

{
    "data": {
        "app_id": 138483919580948, 
        "application": "Social Cafe", 
        "expires_at": 1352419328, 
        "is_valid": true, 
        "issued_at": 1347235328, 
        "metadata": {
            "sso": "iphone-safari"
        }, 
        "scopes": [
            "email", 
            "publish_actions"
        ], 
        "user_id": 1207059
    }
}

这篇关于如何验证Facebook访问令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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