简体   繁体   English

facebook graph API - 获取墙贴

[英]facebook graph API - getting wall posts

I am having trouble getting the hang of the facebook graph API and reading my wall post. 我无法获得facebook图谱API并阅读我的墙贴。

I've created a facebook app and from it now have an App ID and AppSecret, using those, I get an access_token via this url: https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=MYAPPID&client_secret=MYAPPSECRET 我创建了一个Facebook应用程序,现在它有一个App ID和AppSecret,使用这些,我通过这个url得到一个access_token: https ://graph.facebook.com/oauth/access_token?grad_type = client_credentials&client_id = MYAPPID&client_secret = MYAPPSECRET

example: access_token=12313231321312312312 示例:access_token = 12313231321312312312

so then I make the call here: 所以我在这里打电话:

https://graph.facebook.com/MYFACEBOOKID/feed?access_token=12313231321312312312 https://graph.facebook.com/MYFACEBOOKID/feed?access_token=12313231321312312312

however the results I see are not the list of items that are on my wall. 但是我看到的结果不是我墙上的物品清单。 Example I made a post today and it's not in that result. 示例我今天发了一个帖子,而不是那个结果。 The only thing listed there is a friend I added about 2 weeks ago, and nothing else. 那里列出的唯一的东西是我在2周前添加的朋友,没有别的。

If I go to https://developers.facebook.com/tools/explorer and type in the textbox put in /MYFACEBOOKID/feed and submit, then I see the full results of what I would like to get above (using the app secret etc). 如果我转到https://developers.facebook.com/tools/explorer并输入放入/ MYFACEBOOKID / feed并提交的文本框,那么我会看到我想要获得的完整结果(使用应用秘密)等等)。 If I copy the access_token from the explorer page and put that into my url, then I also get the full results. 如果我从资源管理器页面复制access_token并将其放入我的网址,那么我也会得到完整的结果。

So wondering what am I missing? 所以想知道我错过了什么? Do I need to add permissions somewhere, so I can get the same results using the AppID/AppSecret method to request the access_token? 我是否需要在某处添加权限,因此我可以使用AppID / AppSecret方法获取相同的结果来请求access_token?

Or do I just use the access_token from the explorer page in my code? 或者我只是在代码中使用资源管理器页面中的access_token?

grabbing the access token from the graph explorer is not an answer. 从图形资源管理器中获取访问令牌不是一个答案。 You can check though and see if the access token there (select your app, not the graph) is the same that you get with the url. 您可以检查并查看其中的访问令牌(选择您的应用程序,而不是图表)与您使用该URL获取的相同。 For the authorization URL, have you tried something like the following? 对于授权URL,您是否尝试过类似以下内容?

https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=user_likes,user_status,publish_actions,read_stream,ETC_ETC_OR_WHATEVERELSE&response_type=token " https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=user_likes,user_status,publish_actions,read_stream,ETC_ETC_OR_WHATEVERELSE&response_type=token

This works fine for me so it's worth giving a try. 这对我来说很好,所以值得一试。 I also see here that it can still be done this way (not considered bad practice as far as I can see). 我也在这里看到它仍然可以通过这种方式完成(据我所知,不被认为是不好的做法)。 Yes you need permissions in other words. 是的,你需要权限换句话说。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM