Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6849881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:03:11+00:00 2026-05-27T01:03:11+00:00

I am trying to get the friends of a test user using facebook graph

  • 0

I am trying to get the friends of a test user using facebook graph api but it returns only the ids of the friends but not other details like first_name, last_name etc. This works though with real users. I specifically pass the fields that I require (the request looks something like this):

https://graph.facebook.com/me/friends?access_token=...&fields=id%2Cfirst_name%2Clast_name%2Cgender%2Clocale%2Clink%2Clocation%2Cbirthday%2Creligion%2Crelationship_status

The access token is the token granted to the test user when the test user logs in to my application.

I have found a similar SO post but I am not sure what is the solution suggested.

Query test users through Facebook Graph API

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:03:12+00:00Added an answer on May 27, 2026 at 1:03 am

    You need to use the App access_token and this can be tested in the Graph API Explorer by doing the following:

    1. Go to the Access Token tool and copy your app access_token
    2. Go to Graph API Explorer and choose your app from the dropdown list.
    3. Query APP_ID/accounts/test-users?access_token=app_access_token this would retrieve the test users
    4. click on one of the ids (make sure this user is friend with at least one other test user) and change the query to look like: TEST_USER_ID/friends?fields=first_name,last_name,gender&access_token=app_access_token
    5. You are done! 🙂

    UPDATE:
    Based on the comments below, I’ve tried to retrieve the birthday of the test user’s friends but the results were inconsistent.

    • Using test user’s access_token: IDs, birthdays and gender were retrieved but not names
    • Using App access_token: IDs, names and gender were retrieved but not birthdays

    Here’s a simple code:

    <html xmlns:fb="http://www.facebook.com/2008/fbml">
    <head></head>
    <body>
    <div id="fb-root"></div>
    <script>
    // You can retrieve this from: https://developers.facebook.com/tools/access_token/
    var app_access_token = "APP_ACCESS_TOKEN";
      window.fbAsyncInit = function() {
        FB.init({
          appId      : 'APP_ID_HERE', // App ID
          channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
          status     : true, // check login status
          cookie     : true, // enable cookies to allow the server to access the session
          oauth      : true, // enable OAuth 2.0
          xfbml      : true  // parse XFBML
        });
    
        // Additional initialization code here
      };
    
      // Load the SDK Asynchronously
      (function(d){
         var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
         js = d.createElement('script'); js.id = id; js.async = true;
         js.src = "//connect.facebook.net/en_US/all.js";
         d.getElementsByTagName('head')[0].appendChild(js);
       }(document));
    </script>
    
    <table id="friends">
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Gender</th>
            <th>Birthday</th>
        </tr>
    </table>
    
    <script>
    function login(app) {
        FB.login(function(response) {
            if (response.authResponse) {
                var obj = {fields: 'name,gender,birthday', limit: 500};
                if(app)
                    obj.access_token = app_access_token;
                FB.api('/'+response.authResponse.userID+'/friends', 'GET', obj, function(response) {
                    console.log(response);
                    if(response && response.data.length) {
                        var html = '';
                        for(var i=0; i<response.data.length; i++) {
                            html += "<tr>";
                            html += "<td>" + response.data[i].id + "</td>";
                            html += "<td>" + response.data[i].name + "</td>";
                            html += "<td>" + response.data[i].gender + "</td>";
                            html += "<td>" + response.data[i].birthday + "</td>";
                            html += "</tr>";
                        }
                        document.getElementById("friends").innerHTML += html;
                    }
                });
            } else {
                console.log('User cancelled login or did not fully authorize.');
            }
        }, {scope: 'user_birthday,friends_birthday'});
    
    }
    </script>
    <button onclick="login();">List Friends With User Token</button>
    <button onclick="login(1);">List Freinds With App Token</button>
    </body>
    </html>
    

    The result using one of my test user accounts:
    enter image description here
    The first three rows were retrieved with “List Friends With User Token” and the rest with “List Freinds With App Token“.

    Bottom line, this needs Facebook attention!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get friends count via my account using Facebook API. Its working
I am trying to get the names of my friends using FB Graph API
I'm trying to get a list of user's friends using fb connect for the
I'm trying to get all events from all of my friends on Facebook using
I'm trying get online friends by user in XMPP server (Ejabberd). I'm using Ruby
I am trying to get the Connections or user's friends info from LinkedIn using
Problem I am trying to get friends_location from the Facebok Graph API. I am
hello friends i am trying to get a list of user id and want
Using PyFacebook I am trying to register a test user of my site with
I am trying to get data of my Facebook photos using: [self.facebook requestWithGraphPath:@me/photos andDelegate:self]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.