From c90632ea7a6fdc07dc09a96c4b56cee405fce0e3 Mon Sep 17 00:00:00 2001 From: LoneRifle Date: Thu, 18 May 2023 15:01:56 +0800 Subject: [PATCH] fix: introduce openid scope (#544) * fix(scopes): add openid * fix(sgid): properly include openid scope --- lib/express/sgid.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/express/sgid.js b/lib/express/sgid.js index 38781a81..946ffe15 100644 --- a/lib/express/sgid.js +++ b/lib/express/sgid.js @@ -138,7 +138,7 @@ function config(app, { showLoginPage, serviceProvider }) { const encryptedNric = await encryptPayload(nric) const scopesArr = scopes .split(' ') - .filter((field) => field !== 'openid' && field !== 'myinfo.nric_number') + .filter((field) => field !== 'myinfo.nric_number') console.info(`userinfo scopesArr ${scopesArr}`) const myInfoFields = await Promise.all( scopesArr.map((scope) => @@ -236,6 +236,8 @@ const concatMyInfoRegAddr = (regadd) => { const sgIDScopeToMyInfoField = (persona, scope) => { switch (scope) { // No NRIC as that is always returned by default + case 'openid': + return persona.uuid.value case 'myinfo.name': return persona.name.value case 'myinfo.email':