Facebook - 永久性用户访问令牌 [英] Facebook - permanent user access token
问题描述
我的要求是从Facebook相册中获取所有照片,并在我们的公司网站上显示。我可以获取照片,但用户访问令牌仅在60天内有效,这意味着每隔两个月,我将不得不登录公司的公司Facebook帐户,重新生成令牌并更新我的应用程序中的令牌。
有没有办法生成永久访问令牌?
或者还有什么办法在我的应用程序级别重新生成令牌(不显示登录对话框)?
有没有其他方法来获取照片,没有创建应用程序?
移动到Oauth 2.1
它实际上更简单 - 使用你的App ID + App Secret访问令牌
,然后您可以通过 https://graph.facebook.com/v2.1/theO2/feed?access_token=app_id|app_secret
还有一种方法可以调用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.
这篇关于Facebook - 永久性用户访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!