node.js - PassportJS to get Facebook User Location -
i've attempted set strategy user's home in 2 ways, , neither of work. have code passportjs user's address (just city , state)?
strategy attempting both "location" , "address":
profilefields: ['id', 'name','picture.type(large)', 'emails', 'displayname', 'location', 'address', 'about', 'gender'],
attempting using address seen here portablecontacts.net:
user.facebook.location = profile.address.locality + ', ' profile.address.region;
edit: simpler answer
those location fields not yet mapped in code portable contacts schema facebook's own schema. can see map here (and absence of 2 fields).
instead, use facebook schema directly. profilefields array should include location
field, when call authenticate, need request field facebook:
passport.authenticate('facebook', { scope: ['email', 'public_profile', 'user_location'] }));
note in scope array, referred user_location
in profilefields array location
Comments
Post a Comment