I need to get gender from a Facebook user from his public profile via the Facebook Graph API.
Unfortunately, it does not always work. See the following examples:
working: https://graph.facebook.com/1423993568
{ "id": "1423993568", "gender": "male", ... }
not working: https://graph.facebook.com/10152133878666403
{ "error": { "message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api", "type": "GraphMethodException", "code": 100 } }
But when I open the user ID directly over the Internet, it works, and I even see the gender. (Go to the section "About us / Contacts and basic information"). I logged in with my personal account and not this user's friend! http://www.facebook.com/10152133878666403
What is the problem? Is this a problem with a request or security feature from Facebook?
UPDATE:
I can do a workaround like this, but only if I logged in with my browser:
Take app_scoped_user_id and get your Facebook username from the redirect URL when you open this request:
http://www.facebook.com/app_scoped_user_id/10152133878666403 --> https://www.facebook.com/shiffoni --> https://graph.facebook.com/shiffoni
returns:
{ "id": "669926402", "first_name": "Shiffoni", "gender": "female", "last_name": "Leonhardt", "locale": "de_DE", "name": "Shiffoni Leonhardt", "username": "shiffoni" }
Any other ideas to get the gender, real userId or alias?