简体   繁体   English

在没有用户交互的情况下刷新facebook长期访问令牌

[英]Refreshing facebook long lived access token without user interaction

My each user generating a long lived (60 days) access token from my site using graph api.But the problem is when it expires after 60 days, user have to generate it again by coming to my website.Sometimes they forget about token expiration and facebook page feed shows error in their websites. 我的每个用户使用图形api从我的网站生成一个长期(60天)访问令牌。但问题是当它在60天后过期时,用户必须通过访问我的网站再次生成它。有时他们会忘记令牌到期和Facebook页面提要在其网站中显示错误。

in another post i mentioned about how i generate token long ago here- http://stackoverflow.com/questions/16962486/extending-valid-expired-60-days-access-token-without-user-interaction 在另一篇文章中,我提到了很久以前我如何生成令牌 - http://stackoverflow.com/questions/16962486/extending-valid-expired-60-days-access-token-without-user-interaction

Now how do i automatically refresh the long-lived token from code in their site so that user don't need to get token 2nd time by coming to my token generation website page. 现在,我如何从其站点中的代码自动刷新长期令牌,以便用户不需要通过访问我的令牌生成网站页面获得令牌第二次。

in section Generating Long-Lived User Tokens from Server-Side Long-Lived Tokens of facebook help page - https://developers.facebook.com/docs/facebook-login/access-tokens I see ways to refresh token, but is it the way i want that there will be no user interaction while generating token?? 在Facebook帮助页面的Generating Long-Lived User Tokens from Server-Side Long-Lived Tokens部分 - https://developers.facebook.com/docs/facebook-login/access-tokens我看到了刷新令牌的方法,但是它是我希望生成令牌时不会有用户交互的方式?? I need example codes as it's hard to understand. 我需要示例代码,因为它很难理解。

I think so. 我认同。 Try to check this out here: 试着在这里查看:

https://www.sammyk.me/access-token-handling-best-practices-in-facebook-php-sdk-v4 https://www.sammyk.me/access-token-handling-best-practices-in-facebook-php-sdk-v4

Look at "Best Practices for maintaining long lived access tokens over time". 查看“随着时间的推移维持长期访问令牌的最佳实践”。 Guess you may find the answer you need. 猜猜你可能找到你需要的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM