javascript - facebook user location, birthday in node.js | Not Working -


unable location hometown , birthday of user (with access_token) in node.js though works in browser , graph api explorer.

edit: using passport access_token following scopes :

app.get('/auth/facebook', passport.authenticate('facebook', { scope : ["email", "user_location", "user_hometown", "user_birthday"] }));  profilefields: ['id', 'emails', 'name', 'birthday', 'gender', 'location', 'hometown', 'locale', 'age_range'] 

browser url:

https://graph.facebook.com/v2.5/me?fields=id,name,location,age_range,email,birthday,hometown,gender&access_token=access_token_here 

response:

{    "id": "7766..........",    "name": "john doe",    "location": {       "id": "11..........",       "name": "berlin, germany"    },    "age_range": {       "min": 21    },    "email": "john@doe.com",    "birthday": "09/09/1999",    "hometown": {       "id": "10...............",       "name": "green town"    },    "gender": "any" } 

node.js try 1:

var graph = require("fbgraph");  graph.setaccesstoken("token_here");  graph.get("me?fields=gender,name,age_range,email,picture,birthday,about,bio,hometown", function(err, res) {   if(err)       console.log("err ", err);   else       console.log("res ",res); // data here  }); 

node.js try 2:

var request = require('request');  request("https://graph.facebook.com/v2.5/me?fields=id,name,location,age_range,email,birthday,hometown,gender&access_token=" + token,function(err, resp, body){                                 if(!err && resp.statuscode == 200){                                     console.log(body);                                 }                             }); 

response in node.js both tries:

{    "id": "7766..........",    "name": "john doe",    "age_range": {       "min": 21    },    "email": "john@doe.com",    "gender": "any" } //location, hometown, birthday not coming here 


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -