How can I force a facebook access token to expire?

前端 未结 8 1698
执念已碎
执念已碎 2020-12-23 12:00

I\'m doing some testing in the wake of offline_access\'s expiration. I think that since all interactions my app makes with Facebook are done via my servers and are user ini

8条回答
  •  青春惊慌失措
    2020-12-23 12:42

    Like @guleryuz response, but in pratical way:

    Given a valid access_token ${token}:

    $ curl -X GET "https://graph.facebook.com/v2.7/me/permissions?access_token=${token}"
    {"data":[{"permission":"user_friends","status":"granted"},{"permission":"email","status":"granted"},{"permission":"manage_pages","status":"granted"},{"permission":"business_management","status":"granted"},{"permission":"pages_messaging","status":"granted"},{"permission":"pages_messaging_phone_number","status":"granted"},{"permission":"public_profile","status":"granted"}]}
    

    Do revoke request:

    $ curl -X DELETE "https://graph.facebook.com/v2.7/me/permissions?access_token=${token}"
    {"success":true}
    

    Verify revoke:

    $ curl -X GET "https://graph.facebook.com/v2.7/me/permissions?access_token=${token}"
    {"error":{"message":"Error validating access token: The session was invalidated explicitly using an API call.","type":"OAuthException","code":190,"error_subcode":466,"fbtrace_id":"E2UhrNzyyzZ"}}
    

提交回复
热议问题