0

Im trying to get the uid but is retrieving different number.

FB.getLoginStatus(function(response) {
  if (response.status === 'connected') {
    alert ("Your UID is " + response.authResponse.userID);
  }
});

I use Graph API tool and put me?fields=id . The result is 10000607333xxxx (CORRECT UID)

But when I use de js code at the bottom retrieve different uid 1493309240881506

I try with php $facebook->getUser() and is the same different number

What i am doing wrong ?

UPDATE Someone tell me that is the scopeduserid but i need the global uid because with this number i have to verify if is a FAN of my page

SELECT uid FROM page_fan WHERE page_id = '23223322332xxx' and uid="+user_id;

This fql select only gave me results with the global uid.

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Documento sin título</title>
<script src="http://connect.facebook.net/en_US/all.js"></script>

</head>

<body>
<div id="fb-root"></div>
<script>
FB.init(
{
    appId  : '52150228463xxxx',
    status : true, // check login status
    cookie : true, // enable cookies to allow the server to access the session
    xfbml  : true  // parse XFBML
});


    FB.getLoginStatus(function(response) {
  if (response.status === 'connected') {
    alert ("Your UID is " + response.authResponse.userID);
  }
});

</script>
</body>
</html>
  • You are doing nothing wrong. You are getting a app scoped user id back – WizKid Jun 05 '14 at 00:20
  • possible duplicate of [Facebook Graph Api v2.0 me/friends returns empty, or only friends who also use my app](http://stackoverflow.com/questions/23417356/facebook-graph-api-v2-0-me-friends-returns-empty-or-only-friends-who-also-use-m) – WizKid Jun 05 '14 at 00:20
  • I need the global uid because then i have to verify if is FAN of my page with SELECT uid FROM page_fan WHERE page_id = aaaaaa and uid="+user_id; – user3709144 Jun 05 '14 at 00:28
  • The app scoped user id will work too. The user need to give you the permission `user_likes` before you can see what they liked. And I suggest using the Graph API `/me/likes/{page_id}` instead of using FQL that will be deprecated after v2.0. And with that said. If you are building a like-gating feature you can stop. Facebook will not approve your use of `user_likes` so you will not be able to do it – WizKid Jun 05 '14 at 00:34
  • i will try /me/likes/page id, but my chief wants this feature. Do you know where is the official note of facebook where disapproved the like-gating? – user3709144 Jun 05 '14 at 00:39
  • 1
    It been brought up multiple times in https://www.facebook.com/groups/fbdevelopers/ . People have been rejected for it a lot of time and Developer Operations that do the reviews have said that it isn't allowed. – WizKid Jun 05 '14 at 01:44
  • If you're using a Page Tab App, why aren't you using the `page.liked` field of the signed_request? – Tobi Jun 05 '14 at 05:52

0 Answers0