I've recently started working on manual login flow of facebook. And followed this blog to get the access token and using restfb to access user information.
Below is the code snippet as mentioned - Fetching Single Objects:
FacebookClient facebookClient = new DefaultFacebookClient(ACCESS_TOKEN, APP_SECRET);
User user = facebookClient.fetchObject("me", User.class);
I'm successfully able to get the user's name, first name and last name but it returns null
for email
(user.getEmail();
).
My facebook app has default permissions as:
Anyone help me how can I access the user email?
UPDATE
I've been trying the graph-api
explorer to see what I'm getting for email
and it says
Field is empty or disallowed by the access token
. What do I'm supposed to do to fix this?