How to verify Facebook access token?

后端 未结 6 1876
囚心锁ツ
囚心锁ツ 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 03:58

    Just wanted to let you know that up until today I was first obtaining an app access token (via GET request to Facebook), and then using the received token as the app-token-or-admin-token in:

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

    However, I just realized a better way of doing this (with the added benefit of requiring one less GET request):

    GET graph.facebook.com/debug_token?
        input_token={token-to-inspect}
        &access_token={app_id}|{app_secret}
    

    As described in Facebook's documentation for Access Tokens here.

提交回复
热议问题