How to obtain a user access token in Python

吃可爱长大的小学妹 提交于 2019-12-03 16:41:48

You can not get a user access token without a direct interaction of a logged in user with your application using the facebook authentication flows. The only token that can be obtained without a user is the application token and you've got that covered already.

You can create a user token manually, the easiest way, I think, would be to use the Graph Explorer tool. Just select your application on the top right, then click the "Get Access Token" button, you can then check the needed permissions and after that a generated token will appear in the text box, copy that and use it.

The problem with that is that the access token is a short lived one (a few hours), if you need a longer one I suggest that you create a canvas application that will only implement the Server-Side authentication which will end with a long-lived token (60 days), then you can persist it and use it for that time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!