Safe reference Facebook profile location
parent
f56bd90dce
commit
1cc0bb4526
|
@ -68,7 +68,7 @@ passport.use(new FacebookStrategy(secrets.facebook, function (req, accessToken,
|
||||||
user.profile.name = profile.displayName;
|
user.profile.name = profile.displayName;
|
||||||
user.profile.gender = profile._json.gender;
|
user.profile.gender = profile._json.gender;
|
||||||
user.profile.picture = 'https://graph.facebook.com/' + profile.id + '/picture?type=large';
|
user.profile.picture = 'https://graph.facebook.com/' + profile.id + '/picture?type=large';
|
||||||
user.profile.location = profile._json.location.name;
|
user.profile.location = (profile._json.location) ? profile._json.location.name : '';
|
||||||
user.save(function(err) {
|
user.save(function(err) {
|
||||||
done(err, user);
|
done(err, user);
|
||||||
});
|
});
|
||||||
|
@ -150,7 +150,7 @@ passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tok
|
||||||
var user = new User();
|
var user = new User();
|
||||||
// Twitter will not provide an email address. Period.
|
// Twitter will not provide an email address. Period.
|
||||||
// But a person’s twitter username is guaranteed to be unique
|
// But a person’s twitter username is guaranteed to be unique
|
||||||
// so we can “fake” a twitter email address as follows:
|
// so we can "fake" a twitter email address as follows:
|
||||||
user.email = profile.username + "@twitter.com";
|
user.email = profile.username + "@twitter.com";
|
||||||
user.twitter = profile.id;
|
user.twitter = profile.id;
|
||||||
user.tokens.push({ kind: 'twitter', accessToken: accessToken, tokenSecret: tokenSecret });
|
user.tokens.push({ kind: 'twitter', accessToken: accessToken, tokenSecret: tokenSecret });
|
||||||
|
|
Loading…
Reference in New Issue