解释Facebook access_token [英] Explain the Facebook access_token

查看:426
本文介绍了解释Facebook access_token的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

整个Facebook access_token事情让我疯狂。我想要做的就是获取用户的公开Facebook帖子。

This whole Facebook access_token thing is driving me nuts. All I want to do is fetch a user's public Facebook posts.

以前只需按照以下方式工作:

It used to work by simply doing:

$.getJSON('http://graph.facebook.com/USERNAME/posts?limit=LIMIT&callback=?', function (posts) {
    // Posts available in "posts" variable
});

但现在我收到access_token required错误。

But now I get the "access_token required" error.

相信我;我已经检查了文档,谷歌搜索过并检查了类似的问题,但我真的希望有一个比我见过的更直接的方式。

Trust me; I've checked the docs, Googled all over and checked similar questions on SO but I'm really hoping there's a more straight forward way of doing this than what I've seen.

真的必须创建一个Facebook应用程序(我甚至没有帐户),让用户接受应用程序并登录等工作吗?

Do you really have to create a Facebook App (I don't even have an account), make the user "accept" the app and login etc for this to work?

使用Twitter,就像以前一样简单。

With Twitter it's just as easy as it used to be with Facebook.

推荐答案

你真的必须创建一个Facebook应用程序(你需要一个帐户),让用户接受应用程序和登录等工作。

You really have to create a Facebook App (You need to have an account), make the user "accept" the app and login etc for this to work.

但是你可以通过facebook的公共搜索API搜索用户(非特定用户)的公开帖子。

However you can search public posts of user (not a specific user) by facebook's public search api.

例如

https://graph.facebook.com/search?q=hello&type=post

这将搜索所有包含hello关键字的帖子。

This will search all posts with hello keyword in it.

参考(你需要有facebook)帐户查看此页面)

Reference ( you need to have facebook account to see this page )

http ://developers.facebook.com/docs/reference/api/

编辑(看到评论后):

如果您想访问自己网页的公开信息。你可以在没有用户登录的情况下提取它(但你需要一个access_token)

If you want to access public posts of your own page. You can pull it without any login from user (but you will need an access_token)

从这里生成一个离线access_token,

Generate an offline access_token from here,

http://developers.facebook.com/tools/explorer

然后您可以使用该令牌来提取数据。因此无需用户登录。

Then you can use that token to pull data . Thus no need of logging on by user.

https://graph.facebook.com/wesellwine/posts?access_token=<access_token from graph api explorer>

这篇关于解释Facebook access_token的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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