Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Graph API returns false for Page Accounts

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?

like image 241
Joe Avatar asked Nov 27 '22 17:11

Joe


2 Answers

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
like image 65
gaizka Avatar answered Nov 29 '22 07:11

gaizka


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.

like image 23
Itye Richter Avatar answered Nov 29 '22 05:11

Itye Richter