1

我将编写一个将作为 cron 运行的 Facebook Graph 脚本/应用程序。我之前尝试过这样做,但它说访问令牌已过期。我尝试使用getAccessToken(),但它告诉我必须使用有效的访问令牌来请求有关当前用户的信息。如何自动更新我的访问令牌,这样我的 cron 工作就不会中断?

4

2 回答 2

0

The normal access token expires in 2 hours, and the extended token lasts for 2 months. For the extended token guide, go though this: How to extend access token validity since offline_access deprecation

Now, the best thing you can do is to update regularly this extended token of the user when he log-in the app/website. So, you can use this token in your cron job. This will fail only when the user didn't visit your app for 2 months.

于 2012-12-22T09:53:41.580 回答
0

您是否在以下链接中验证了您的访问令牌已过期?

https://developers.facebook.com/tools/debug

此外,您可以通过访问类似问题获得详细答案:

如何使用 PHP 更新/扩展 facebook 访问令牌?

于 2012-12-22T10:00:19.100 回答