Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Graph API only returns user name

I was using Facebook's graph api, asking for '/me', and it only returns the name and Id of the user. I know that it logs in properly, because it returns the correct name.

Here is a snippet of the javascript code I was using:

FB.login(function (response) {
    // handle the response
    FB.api('/me', function (usrresponse) {
        document.getElementById('inFbStatus').innerHTML = 'Successful login to Facebook';
        console.log(JSON.stringify(usrresponse));
    });
}, { scope: 'email, basic_info' });
like image 832
raq583 Avatar asked Jul 24 '15 01:07

raq583


People also ask

How do I get my Facebook graph API User ID?

The simplest way to get a copy of the User Profile object is to access the /me endpoint: FB. api('/me', function(response) { }); This will this will return the users name and an ID by default.

How do I get data from Facebook graph API?

Open the Graph Explorer in a new browser window. This allows you to execute the examples as you read this tutorial. The explorer loads with a default query with the GET method, the lastest version of the Graph API, the /me node and the id and name fields in the Query String Field, and your Facebook App.

Is Facebook graph API deprecated?

Applies to all versions. Facebook Analytics will no longer be available after June 30, 2021. Additionally, we are deprecating the App Dashboard Plugin for Marketing API. For more information visit the Business Help Center.

What 3 terms does Facebook use to describe what the graph API is composed of?

The Graph API is named after the idea of a "social graph" — a representation of the information on Facebook. It's composed of nodes, edges, and fields.


1 Answers

You have to specify each field and edge you want to get returned, e. g.

/me?fields=id,name,email
like image 114
Tobi Avatar answered Oct 15 '22 18:10

Tobi