Facebook graph api no email in access token
while using facebook graph api in authenticating a user, after successful login, i want to get the user email.
For this, i r开发者_高级运维aised 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
Yes, you have to ask permission for email. If you already ask email in the request and still you are not getting email id on the response then it is due to user sign up with mobile number and didn't enter his email id in profile.
精彩评论