简体   繁体   English

Facebook图形-如何通过PHP SDK重新生成用户访问令牌

[英]Facebook graph - how to regenerate user access token through PHP SDK

I'm trying to search Facebook for relevant groups depending on keywords. 我正在尝试根据关键字在Facebook中搜索相关的群组。 I'm using to graph explorer and it works fine. 我正在使用图形资源管理器,它工作正常。

search?&type=group&q=php&access_token=MY_TOKEN 搜索?&键入=基团Q = PHP&=的access_token MY_TOKEN

Is there anyway I can perform this search from my server using a (my) user access token and keep renewing the access token through the PHP SDK? 无论如何,我是否可以使用(我的)用户访问令牌从服务器执行此搜索,并通过PHP SDK不断更新访问令牌?

From looking at the documentation it looks like I have to use a user access token that requires a login and expires after a set amount of time? 通过查看文档,看起来我必须使用需要登录并在设置的时间后过期的用户访问令牌?

As the facebook docs here say . 正如facebook文档在这里所说。 you will have to extend the token when it expires . 您必须在令牌过期时扩展令牌。 i guess its a security measure from facebook to ensure that the user is still active with the app . 我想这是来自Facebook的一项安全措施,以确保用户仍在使用该应用程序。

Even the long-lived access token will eventually expire. 甚至长寿命的访问令牌最终也会过期。 At any point, you can generate a new long-lived token by sending the person back to the login flow used by your web app - note that the person will not actually need to login again, they have already authorized your app, so they will immediately redirect back to your app from the login flow with a refreshed token 在任何时候,您都可以通过将该人发送回您的Web应用程序使用的登录流程来生成新的长期令牌-请注意,该人实际上不需要再次登录,因为他们已经授权了您的应用程序,因此他们将立即使用刷新的令牌从登录流重定向回您的应用

A long lived access token is valid for 60 days . 长期访问令牌的有效期为60天。 All you need is to supply the new access token once in a while to your php script . 您所需要的只是不时地为您的php脚本提供新的访问令牌。 ( assuming you are just using your token for performing the search ) (假设您只是使用令牌来执行搜索)

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

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