使用PHP获取FB的访问令牌

时间:2015-07-27 21:25:30

标签: php facebook facebook-graph-api facebook-php-sdk

我正在尝试获取FB访问令牌以获取用户的事件。对于相同的我无法找到使用REST的解决方案。看起来所有FB使用的是Graph API。

https://developers.facebook.com/tools/explorer/处的工具能够给我一个令牌,但它是短暂的,并且会在几个小时后到期。我需要能够保持更长时间且用户互动最少的东西。如果需要,可以进行零交互(可以从cookie中获取FB会话详细信息并传递)

我可能想避免的事情: 1. FB PHP SDK 2. FB应用程序权限对话框,因为用例是chrome扩展名,我不确定FB是否可以从Chrome extns调用对话框。

我关注:https://www.sammyk.me/access-token-handling-best-practices-in-facebook-php-sdk-v4但正如我所提到的,我不想使用SDK,这就是它的用途。

1 个答案:

答案 0 :(得分:0)

你的意思是?

graph.facebook.com/me/events?method=get&access_token={usertoken}

如果您正在寻找接受该权限的访问权限,那么您可以使用HTC应用程序权限。

  

https://www.facebook.com/v1.0/dialog/oauth?redirect_uri=http%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html&scope=email%2Cpublish_actions%2Cuser_about_me%2Cuser_actions.books%2Cuser_actions.music%2Cuser_actions.news%2Cuser_actions.video%2Cuser_activities%2Cuser_birthday%2Cuser_education_history%2Cuser_events%2Cuser_games_activity%2Cuser_groups%2Cuser_hometown%2Cuser_interests%2Cuser_likes%2Cuser_location%2Cuser_notes%2Cuser_photos%2Cuser_questions%2Cuser_relationship_details%2Cuser_relationships%2Cuser_religion_politics%2Cuser_status%2Cuser_subscriptions%2Cuser_videos%2Cuser_website%2Cuser_work_history%2Cfriends_about_me%2Cfriends_actions.books%2Cfriends_actions.music%2Cfriends_actions.news%2Cfriends_actions.video%2Cfriends_activities%2Cfriends_birthday%2Cfriends_education_history%2Cfriends_events%2Cfriends_games_activity%2Cfriends_groups%2Cfriends_hometown%2Cfriends_interests%2Cfriends_likes%2Cfriends_location%2Cfriends_notes%2Cfriends_photos%2Cfriends_questions%2Cfriends_relationship_details%2Cfriends_relationships%2Cfriends_religion_politics%2Cfriends_status%2Cfriends_subscriptions%2Cfriends_videos%2Cfriends_website%2Cfriends_work_history%2Cads_management%2Ccreate_event%2Ccreate_note%2Cexport_stream%2Cfriends_online_presence%2Cmanage_friendlists%2Cmanage_notifications%2Cmanage_pages%2Cphoto_upload%2Cpublish_stream%2Cread_friendlists%2Cread_insights%2Cread_mailbox%2Cread_page_mailboxes%2Cread_requests%2Cread_stream%2Crsvp_event%2Cshare_item%2Csms%2Cstatus_update%2Cuser_online_presence%2Cvideo_upload%2Cxmpp_login&response_type=token&client_id=41158896424