How do I use the access token to get email address and some basic info of facebook users
facebook, facebook-graph-api, javascript, jquery
Solution
You dont have to use the ajax call after FB.login, you can use `FB.api` doc , which will ensure that the access token that you have obtained while logging in (requiring email access) will be used for accessing the data
Problem
I have the follwing code and would like to take the email address and other details of facebook user. This is the code that I have done. ``` FB.login(function(response) { if (response.authResponse) { //updateUserInfo(fb_id); console.log(response.authResponse); updateUserInfo(response.authResponse.userID); $.ajax({ dataType: "json", url: 'http://graph.facebook.com/'+response.authResponse.userID+'/ fields=id,name,birthday,email,gender,hometown,location', success: function(data){ fb_data = data; console.log(data); }}); },{scope:'email'}); ``` I am unable to get get the following details: - birthday - email - Location - hometown However, I am able to get the first name and id. If I am supposed to use the access token, how am i supposed to put it in the query? The email address is the vital information as my system identifies user by email address.