Return all basic google and facebook profile fields

This commit is contained in:
jperl
2013-02-04 19:23:11 -05:00
committed by Nick Martin
parent 30fe79bf1b
commit 8307460df8
2 changed files with 16 additions and 4 deletions

View File

@@ -9,12 +9,18 @@
var identity = getIdentity(accessToken);
var serviceData = {
id: identity.id,
accessToken: accessToken,
email: identity.email,
expiresAt: (+new Date) + (1000 * response.expiresIn)
};
// include all fields from facebook
// http://developers.facebook.com/docs/reference/login/public-profile-and-friend-list/
var whitelisted = ['id', 'email', 'name', 'first_name',
'last_name', 'link', 'username', 'gender', 'locale', 'age_range'];
var fields = _.pick(identity, whitelisted);
_.extend(serviceData, fields);
return {
serviceData: serviceData,
options: {profile: {name: identity.name}}

View File

@@ -7,12 +7,18 @@
var identity = getIdentity(accessToken);
var serviceData = {
id: identity.id,
accessToken: accessToken,
email: identity.email,
expiresAt: (+new Date) + (1000 * response.expiresIn)
};
// include all fields from google
// https://developers.google.com/accounts/docs/OAuth2Login#userinfocall
var whitelisted = ['id', 'email', 'verified_email', 'name', 'given_name',
'family_name', 'picture', 'locale', 'timezone', 'gender'];
var fields = _.pick(identity, whitelisted);
_.extend(serviceData, fields);
// only set the token in serviceData if it's there. this ensures
// that we don't lose old ones (since we only get this on the first
// log in attempt)