Facebook的graphApi的OAuth - 如何获得访问令牌? [英] Facebook graphApi oAuth - how to get access token?

查看:584
本文介绍了Facebook的graphApi的OAuth - 如何获得访问令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

欢迎!

我试图让墙贴使用的JavaScript功能NEW SDK某个用户。当我尝试这样做图形API资源管理器,它工作正常。当我尝试做它在我的网站,我有一个错误:

I try to get wall posts from a certain user using JavaScript Faceboook SDK. While im trying to do so in graph Api Explorer, it works fine. While I try to do it on my website, I have an error:

code: 104
message: "An access token is required to request this resource."
type: "OAuthException"

所以,我的问题是:如果我想显示在网站上我公司的Facebook页面流,我应该如何获得访问令牌这样做呢?

So, my question is: If I want to show my company facebook page stream on website, how should I get the access token to do so?

推荐答案

是的,你需要一个访问令牌来获取由一个Facebook页面的帖子。由于页面职位是公开的任何访问令牌会工作。您应该使用一个应用程序访问令牌,因为它永不过期

Yes, you need an Access Token to fetch posts made by a Facebook Page. As the page posts are public any access token will work. You should use an app access token as it never expires.

我)访问 https://developers.facebook.com/apps 并创建一个新的应用
二)填写所需的应用程序名称和命名空间
三)在部分选择如何您的应用程序集成了Facebook的选择网站与Facebook登录
六)在网站地址字段中输入您的网站网址。记得添加一个尾随'/'
v)的访问这里让你的应用令牌

i) Visit https://developers.facebook.com/apps and create a new app
ii) Fill in the desired App Name and Namespace
iii) In the section 'Select how your app integrates with Facebook' choose 'Website with Facebook Login'
vi) Enter your website URL in the 'Site URL' field. Remember to add a trailing '/'
v) Visit here to get your App Token.

请调用图形API来抓取页面的帖子

Make calls to the graph API to fetch page posts

https://graph.facebook.com/pageID/feed?access_token=your_token

这篇关于Facebook的graphApi的OAuth - 如何获得访问令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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