From 32549c87c5b879031812ab951502766b9b5dc3ac Mon Sep 17 00:00:00 2001 From: PauloVDosSantos Date: Wed, 21 Aug 2024 14:23:53 -0300 Subject: [PATCH] feat: Add standard 'name' in 'profile' => same structure from other providers (givenName and familyName) --- lib/profile.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/profile.js b/lib/profile.js index f4b053a..f584171 100644 --- a/lib/profile.js +++ b/lib/profile.js @@ -22,5 +22,12 @@ exports.parse = function(json) { if (json.avatar_url) { profile.photos = [{ value: json.avatar_url }]; } + if (json.name) { + const [firstName, ...otherNames] = json.name.split(' '); + profile.name = { + givenName: firstName, + familyName: otherNames.join(' ') + }; + } return profile; };