Facebook - 永久用户访问令牌 [英] Facebook - permanent user access token

查看:36
本文介绍了Facebook - 永久用户访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司有一个公司 Facebook 帐户,他们在不同的相册中发布活动照片.我的要求是从 facebook 相册中获取所有照片并显示在我们的公司网站上.我能够获取照片,但用户访问令牌的有效期仅为 60 天,这意味着每隔两个月我必须登录公司的公司 Facebook 帐户,重新生成令牌并在我的应用程序中更新令牌.

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?

推荐答案

转向 Oauth 2.1它实际上要简单得多 - 使用您的 App ID + App Secret 作为访问令牌然后,您可以通过 https://graph 访问提要(等).facebook.com/v2.1/theO2/feed?access_token=app_id|app_secret

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

(来自关于访问令牌的 Facebook 文档)

还有另一种无需使用生成的应用令牌即可调用图形 API 的方法.您可以在拨打电话时将您的应用 ID 和应用机密作为 access_token 参数传递:

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选择使用生成的访问令牌还是此方法取决于您隐藏应用机密的位置.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆