-1

I have created 2 App ID from Facebook's developer's page. I'm able to get the user's email address, first name, last name and the id using one of the app ID but on using another app ID, I'm only getting the user's full name and his/her id.

The URL of the App ID which fetches all the desired details is online whereas the one that only fetches the full name is on my localhost.

I'm using the below code,

function testAPI() {
              console.log('Welcome!  Fetching your information.... ');
              FB.api('/me', function(response) {
                console.log('Successful login for: ' + response.name);
                console.log(JSON.stringify(response));
              });
            }

So my question is how to get the details like first name, last name and email from the app hosted on my localhost? Is there any kind of setting I have to do from the developer's page?

Saumil
  • 2,521
  • 5
  • 32
  • 54

1 Answers1

10
Fb.api(  '/me?fields=id,email,first_name,last_name', function(response) { console.log('Successful login for: ' + response.name); console.log(JSON.stringify(response)); });

Also remember that some fields require user permissions also.
And to run on localhost you need to add localhost in your app setting's app domain. Good luck

Salman Aslam
  • 437
  • 3
  • 8