Facebook Graph API 为页面帐户返回 false

发布于 2024-10-19 03:46:17 字数 421 浏览 3 评论 0原文

我正在尝试为我的网站使用 facebook connect。 当我尝试以普通用户身份登录时,一切都很好,所有正确的信息都会返回。 然而,当我以“PAGE”帐户登录时,事情开始变得奇怪。 成功登录后,如果我使用以下命令: https://graph.facebook.com/me/?access_token={访问令牌} ,我得到“假”回来。 如果我用页面帐户的 ID 替换“me”,那么我会得到正确的信息。

另一个问题是,登录后,fbs_appID 会话 cookie 在作为“PAGE”帐户成功登录后设置错误的“uid”。使用普通用户帐户一切正常。

我的页面上的所有设置都是“13+”,并且没有国家/地区限制。

有人可以帮忙吗?

I am trying to use facebook connect for my website.
All is well when I try and login as a normal user, all the correct information comes back.
However, when I log in as a "PAGE" account, things start to get weird.
After a successful login, if I use the following:
https://graph.facebook.com/me/?access_token={access token}, I get "false" back.
If I instead replace "me" with the ID of the page account, then I get the correct information back.

Another issue is, after login the fbs_appID session cookie is setting the wrong "uid" after a successful login as a "PAGE" account. All is well with a normal user account.

All settings on my page are "13+", and there are no country restrictions.

Can anyone please help?

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

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

发布评论

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

评论(4

软甜啾 2024-10-26 03:46:17

我们也遇到了同样的行为。

如果在以 Facebook 页面身份登录时登录,Facebook 通常会显示一个对话框,内容类似于“您无法以 Facebook 页面身份登录。切换到 xxx 用户”。

因此,您应该始终在 FB 连接代码中获得普通用户。

但有时 Facebook 似乎没有正确处理这一问题,并允许用户尝试以 Facebook 页面身份登录。然后您获得的访问代码不允许您获取用户信息。

所以我认为你无能为力,只是警告用户他必须以普通用户 Facebook 个人资料登录。

这是我们获得的完整交通信息:(代码已匿名):

GET /oauth/access_token?client_id=xxxxx&redirect_uri=xxxxx&client_secret=xxxx&code=xxx HTTP/1.1
Connection: close
Host: graph.facebook.com


HTTP/1.1 200 OK
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: text/plain; charset=UTF-8
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Pragma: no-cache
X-FB-Rev: 401390
X-FB-Server: 10.42.17.21
Connection: close
Date: Wed, 06 Jul 2011 10:38:11 GMT
Content-Length: 122

access_token=xxxx&expires=4909



GET /me?access_token=xxxx HTTP/1.1
Connection: close
Host: graph.facebook.com

HTTP/1.1 200 OK
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: text/javascript; charset=UTF-8
ETag: \"7cb6efb98ba5972a9b5090dc2e517fe14d12cb04\"
Expires: Sat, 01 Jan 2000 00:00:00 GMT
P3P: CP=\"Facebook does not have a P3P policy. Learn why here: http://fb.me/p3p\"
Pragma: no-cache
X-FB-Rev: 401390
Set-Cookie: datr=aTsUTlxHtaaaK67aCdYmQbCO; expires=Fri, 05-Jul-2013 10:39:37 GMT; path=/; domain=.facebook.com; httponly
X-FB-Server: 10.32.3.116
Connection: close
Date: Wed, 06 Jul 2011 10:39:37 GMT
Content-Length: 5

false

We are getting that same behaviour.

If are logging in while logged as a Facebook Page, Facebook usually shows a dialog saying something like "You cannot log in as a Facebook Page. Switch to xxx user".

So you should always get a regular user in your FB connect code.

But it looks like sometimes Facebook does not handle that properly, and allow the user to try to log in as a Facebook Page. And then the access code you get does not allow you to get user info.

So I think there is nothing you can do, just warn the user that he has to log in as a regular user Facebook Profile.

This is the full traffic info we get: (with codes anonymized):

GET /oauth/access_token?client_id=xxxxx&redirect_uri=xxxxx&client_secret=xxxx&code=xxx HTTP/1.1
Connection: close
Host: graph.facebook.com


HTTP/1.1 200 OK
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: text/plain; charset=UTF-8
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Pragma: no-cache
X-FB-Rev: 401390
X-FB-Server: 10.42.17.21
Connection: close
Date: Wed, 06 Jul 2011 10:38:11 GMT
Content-Length: 122

access_token=xxxx&expires=4909



GET /me?access_token=xxxx HTTP/1.1
Connection: close
Host: graph.facebook.com

HTTP/1.1 200 OK
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: text/javascript; charset=UTF-8
ETag: \"7cb6efb98ba5972a9b5090dc2e517fe14d12cb04\"
Expires: Sat, 01 Jan 2000 00:00:00 GMT
P3P: CP=\"Facebook does not have a P3P policy. Learn why here: http://fb.me/p3p\"
Pragma: no-cache
X-FB-Rev: 401390
Set-Cookie: datr=aTsUTlxHtaaaK67aCdYmQbCO; expires=Fri, 05-Jul-2013 10:39:37 GMT; path=/; domain=.facebook.com; httponly
X-FB-Server: 10.32.3.116
Connection: close
Date: Wed, 06 Jul 2011 10:39:37 GMT
Content-Length: 5

false
孤寂小茶 2024-10-26 03:46:17

我已从页面设置中删除了“默认”国家/地区限制,并且数据通过 Graph API 恢复正常。最好知道为什么它会影响 api 请求。

I have removed a "default" country restriction from the page settings, and the data came normal via the Graph API. It would be good to know why it affects the api requests.

静若繁花 2024-10-26 03:46:17

我认为您的登录部分有问题。

如果您使用的是 Javascript SDK:

尝试此 console.dir(FB.getSession());

如果您使用的是 PHP SDK:
然后尝试:

$session = $facebook->getSession();
print_r($session);

并检查控制台是否获得正确的会话。

http://graph.facebook.com/me 在您登录之前始终可用。它甚至不需要任何额外的权限。

I think something is wrong with your login part.

If you are using Javascript SDK:

Try this console.dir(FB.getSession());

If you are using PHP SDK:
then try:

$session = $facebook->getSession();
print_r($session);

And check in console if you are getting the proper session or not.

http://graph.facebook.com/me is always available until and unless you are logged in. It doesn't even require any additional permissions.

梦里寻她 2024-10-26 03:46:17

从页面设置中删除任何年龄和/或国家/地区限制。

Remove any Age and/or Country restrictions from the page settings.

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