0

I am trying to login to my website using my Facebook account but Facebook is giving name and id only that is not enough to login user. Before I was getting full information like firstname, lastname, email etc.

Data provided by facebook now:

stdClass Object
(
    [name] => FName LName
    [id] => 236189327864097
)

follows fails

FB.api('/me/feed?fields=gender', function(response)
code:100
fbtrace_id:"DolPwbvNcEH"
message:"(#100) Unknown fields: gender."
type:"OAuthException"

I am using Oauth v2.0 to login users through Facebook to my website.

I need as follows

stdClass Object
(
    [name] => FName LName
    [id] => 236189327864097,
    [gender] female
)

1 Answers1

4
FB.api('/me', {fields: 'first_name,last_name,email'}, function(response) {
    console.log(response);
}

You need to specify the fields you want to get. You definitely never get the emails in the /me/feed endpoint though, email needs a separate permission and is not a field of the posts table: https://developers.facebook.com/docs/graph-api/reference/post

For example, this is how to get the user who posted something:

FB.api('/me/feed', {fields: 'message,from'}, function(response) {
    console.log(response);
}
andyrandy
  • 72,880
  • 8
  • 113
  • 130