while using facebook graph api in authenticating a user, after successful login, i want to get the user email.
For this, i raised a request for user data: https://graph.facebook.com/me?access_token=xxxxxxxxxx
But for my surprise, i could not get user's email in json output... how can i get the email ? Do we need to specify any permissions ?
You have to force it, like this:
...graph.facebook.com/me?**fields=email,name**&access_token...
Then you can use the object user->email
Well yes you do need permission to grab someone's email although some people have their privacy set so that you can get their emails without this expressed permission, most don't.
The permissions need to be set under the login section (it depends on how you login as to how it is presented, so I can't really help you out there unless I have more info).
'user_about_me' is the user permission that you probably already have but you need 'email' to get their primary email.
More information on the permissions for facebook developers can be found here.
I hope this has helped!
Best of luck,
Jon
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With