From ceb88ff94968e995f03656466d7695f5f7a77423 Mon Sep 17 00:00:00 2001 From: Paulo Vitor dos Santos <105461935+paulv-dossantos@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:23:56 -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 a191b4a..8a8dbfe 100644 --- a/lib/profile.js +++ b/lib/profile.js @@ -21,6 +21,13 @@ 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; };