Initial working google auth
This commit is contained in:
parent
fb52d49f74
commit
00a40f6bba
1058 changed files with 114441 additions and 0 deletions
40
auth-service/node_modules/passport-google-oauth20/lib/profile/openid.js
generated
vendored
Normal file
40
auth-service/node_modules/passport-google-oauth20/lib/profile/openid.js
generated
vendored
Normal file
|
|
@ -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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue