From 3b002a6fb136b9e7e534ffbcfedabed72fcd373d Mon Sep 17 00:00:00 2001 From: nanalelfe Date: Tue, 26 Jul 2016 21:45:42 -0400 Subject: Added passport-facbeook --- .../passport-google-oauth20/lib/profile/openid.js | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 node_modules/passport-google-oauth20/lib/profile/openid.js (limited to 'node_modules/passport-google-oauth20/lib/profile/openid.js') diff --git a/node_modules/passport-google-oauth20/lib/profile/openid.js b/node_modules/passport-google-oauth20/lib/profile/openid.js new file mode 100644 index 0000000..2056feb --- /dev/null +++ b/node_modules/passport-google-oauth20/lib/profile/openid.js @@ -0,0 +1,40 @@ +/** + * Parse profile. + * + * Parses user profiles as fetched from Google's OpenID Connect-compatible user + * info endpoint. + * + * The amount of detail in the profile varies based on the scopes granted by the + * user. The following scope values add additional data: + * + * `profile` - basic profile information + * `email` - email address + * + * References: + * - https://developers.google.com/identity/protocols/OpenIDConnect + * + * @param {object|string} json + * @return {object} + * @access public + */ +exports.parse = function(json) { + if ('string' == typeof json) { + json = JSON.parse(json); + } + + var profile = {}; + profile.id = json.sub; + profile.displayName = json.name; + if (json.family_name || json.given_name) { + profile.name = { familyName: json.family_name, + givenName: json.given_name }; + } + if (json.email) { + profile.emails = [ { value: json.email, verified: json.email_verified } ]; + } + if (json.picture) { + profile.photos = [{ value: json.picture }]; + } + + return profile; +}; -- cgit v1.2.3