Developers.facebook.com 颁发的访问令牌 VS 生成的 OAuth

发布于 2024-12-09 05:29:51 字数 926 浏览 5 评论 0原文

我现在遇到一个有趣的问题。

登录应用程序会获得如下所示的访问令牌:

AAACwFsGcSr4BAOGUTwfuZAWuUcwZC0rJ7noZCKMqhBI7ivDCsIGqduGIZCus5PRaS6KuREqxLmhfvZAZAkz5WCpFfANtUpYHgZD

此访问令牌无法访问用户的 PUBLIC 信息,而 Facebook 在 developers.facebook.com 上发布的访问令牌 - CAN。

您可以通过登录 Facebook 并访问此链接轻松测试此功能:http://developers。 facebook.com/docs/reference/api/

您将看到 Facebook 自动在 DEMO url 上生成访问令牌,如下所示:

https://graph.facebook.com/me/music
    ?access_token=2227470867|2.AQCvlA_ZaJ2MfRR0.3600.1318266000.0-100001572415177|2FeweU6ZvOQS9OCF5ZBV58_PtPg

如果您将 /ME/ 更改为任何将其音乐发布为公开的用户,您将能够使用 Graph API 访问该数据。

现在尝试获取应用程序的访问令牌,并使用生成的访问令牌调用相同的 Graph API 方法,返回的数据是空 JSON 对象。

这些访问令牌之间有什么区别?如何获取访问令牌,以便我可以使用 Graph API 获取公共信息?

我认为登录您的应用程序是可能的最高访问令牌,唯一更高的令牌是具有指定权限的令牌......

任何指导方针都会很棒:)

Interesting problem I'm having right now.

Signing in an App gives a access token looking something like this:

AAACwFsGcSr4BAOGUTwfuZAWuUcwZC0rJ7noZCKMqhBI7ivDCsIGqduGIZCus5PRaS6KuREqxLmhfvZAZAkz5WCpFfANtUpYHgZD

This access token can't access users PUBLIC information, while one issued by Facebook on developers.facebook.com - CAN.

You can easily test this by logging to your facebook and going to this link: http://developers.facebook.com/docs/reference/api/

You'll see that Facebook automatically generates access token on DEMO urls like this one:

https://graph.facebook.com/me/music
    ?access_token=2227470867|2.AQCvlA_ZaJ2MfRR0.3600.1318266000.0-100001572415177|2FeweU6ZvOQS9OCF5ZBV58_PtPg

If you would change /ME/ to any user which has his MUSIC posted as public, you WILL be able to access that data with Graph API.

Now try to get an access token to your APP and call the same Graph API method with generated access token, the returned data is empty JSON object.

Whats’ the difference between these access tokens? How to obtain access token, that I could get public information using Graph API?

I was thinking that logging in your APP is the highest possible access token and the only higher token is token with specified permissions...

Any guidelines would be great :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光是把杀猪刀 2024-12-16 05:29:51

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

我相信区别在于您可以在范围参数中指定额外的权限,
因此,如果您想读取用户的提要,则必须指定 read_stream。我试图使用 ruby​​ 中服务器端身份验证流程的访问令牌来实现此目的,但访问令牌只允许我导航到 graph.facebook.com/user_id/feed 的特定部分?请求。如果您有任何见解或遇到解决方案,如果可以的话,也可以按照我的方式进行。

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

I believe the difference is that you can specify additional permissions in a scope parameter,
so if you wanted to read a user's feed you would have to specify read_stream. I was trying to accomplish this with an access token from a server-side authentication flow in ruby, but the access token only allowed to me to navigate accross a certain portion of graph.facebook.com/user_id/feed? requests. If you get any insights or comes across a solution shoot it my way too, if you can.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文