Facebook Graph API 为页面帐户返回 false
我正在尝试为我的网站使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我们也遇到了同样的行为。
如果在以 Facebook 页面身份登录时登录,Facebook 通常会显示一个对话框,内容类似于“您无法以 Facebook 页面身份登录。切换到 xxx 用户”。
因此,您应该始终在 FB 连接代码中获得普通用户。
但有时 Facebook 似乎没有正确处理这一问题,并允许用户尝试以 Facebook 页面身份登录。然后您获得的访问代码不允许您获取用户信息。
所以我认为你无能为力,只是警告用户他必须以普通用户 Facebook 个人资料登录。
这是我们获得的完整交通信息:(代码已匿名):
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):
我已从页面设置中删除了“默认”国家/地区限制,并且数据通过 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.
我认为您的登录部分有问题。
如果您使用的是 Javascript SDK:
尝试此
console.dir(FB.getSession());
如果您使用的是 PHP SDK:
然后尝试:
并检查控制台是否获得正确的会话。
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:
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.从页面设置中删除任何年龄和/或国家/地区限制。
Remove any Age and/or Country restrictions from the page settings.