How to verify Facebook access token?

后端 未结 6 1888
囚心锁ツ
囚心锁ツ 2020-11-28 03:26

There\'s only thing that server has to do; just check any access token\'s validity.

Clients send to the server user id and access token obtained by FB.getLogin

6条回答
  •  生来不讨喜
    2020-11-28 04:09

    The officially supported method for this is:

    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.

    An example response is:

    {
        "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
        }
    }
    

提交回复
热议问题