You did not specify which SDK you use, I assume that you are using PHP
below is the php code, and I think that if you can use any other SDK, you can also use the code below with some necessary changes and yes, this code works fine, I tested this code before answering here :)
<?php //get the user gender $user_id = $facebook->getUser(); $user_profile = $facebook->api('/me','GET'); $user_gender = $user_profile['gender']; echo "Gender: " . $user_gender; ?>
You need the permission user_about_me if the user gender is not public, and you can also get the gender of friends of users using the friends_about_me permission if the user has set it public
below - my authorization code, which must be entered into your authorization code, use the code above in the field
$auth_url = "http://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($canvas_page) . ("&scope=email,read_stream,publish_stream,offline_access,publish_actions,user_about_me,fiends_about_me&response_type=token"
source share