且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Facebook - 永久性用户访问令牌

更新时间:2023-12-01 20:31:40

移动到Oauth 2.1
它实际上更简单 - 使用你的App ID + App Secret访问令牌
,然后您可以通过 https://graph.facebook.com/v2.1/theO2/feed?access_token=app_id|app_secret



(从关于访问令牌的Facebook文档


还有一种方法可以调用Graph API,而不需要使用生成的应用程序令牌。拨打电话时,您可以通过access_token参数传递您的应用ID和应用程式密码:



http://graph.facebook.com/endpoint?key=value&access_token=app_id|app_secret
选择使用生成的访问令牌与此方法取决于您隐藏应用程序秘密的位置。



My company has a corporate facebook account where they post event pics in different albums. My requirement is to get all the photos from facebook albums and show in our corporate website. I am able to fetch the photos but the user access token is valid only for 60 days which means every other two months i will have to login into company's corporate facebook account, regenerate the token and update the token in my application.

Is there any way to generate to permanent access token? or is ther any way to regenerate the token at my application level ( without showing login dialog box)?

Is there any other way to fetch the photos without creating app?

moving to Oauth 2.1 it is actually MUCH simpler - use your App ID + App Secret as access token you can then access the feed (etc) via https://graph.facebook.com/v2.1/theO2/feed?access_token=app_id|app_secret

(from Facebook documentation on Access Tokens)

There is another method to make calls to the Graph API that doesn't require using a generated app token. You can just pass your app id and app secret as the access_token parameter when you make a call:

http://graph.facebook.com/endpoint?key=value&access_token=app_id|app_secret The choice to use a generated access token vs. this method depends on where you hide your app secret.