This commit is contained in:
+3
-2
@@ -182,8 +182,9 @@ function requiredAuthConfig(env) {
|
|||||||
function normalizeClaims(claims) {
|
function normalizeClaims(claims) {
|
||||||
const profile = claims.profile && typeof claims.profile === 'object' ? claims.profile : {};
|
const profile = claims.profile && typeof claims.profile === 'object' ? claims.profile : {};
|
||||||
const custom = claims.customAttributes || claims.custom_attributes || {};
|
const custom = claims.customAttributes || claims.custom_attributes || {};
|
||||||
const profilePhones = Array.isArray(profile.phones) ? profile.phones : [];
|
const profilePhones = Array.isArray(profile.phones) ? profile.phones : (Array.isArray(claims.phones) ? claims.phones : []);
|
||||||
const profilePhone = profile.phone || profile.phone_number || profilePhones[0]?.number || profilePhones[0]?.value || profilePhones[0] || '';
|
const firstProfilePhone = profilePhones[0];
|
||||||
|
const profilePhone = profile.phone || profile.phone_number || firstProfilePhone?.phoneNumber || firstProfilePhone?.phone_number || firstProfilePhone?.number || firstProfilePhone?.value || firstProfilePhone?.phone || firstProfilePhone || '';
|
||||||
const tenants = claims.tenants || claims.tenantIds || custom.tenants || [];
|
const tenants = claims.tenants || claims.tenantIds || custom.tenants || [];
|
||||||
const tenantList = Array.isArray(tenants) ? tenants : Object.keys(tenants).map((key) => ({ id: key, ...(tenants[key] || {}) }));
|
const tenantList = Array.isArray(tenants) ? tenants : Object.keys(tenants).map((key) => ({ id: key, ...(tenants[key] || {}) }));
|
||||||
const tenantId = claims.tenant_id || claims.tenantId || custom.tenant_id || custom.tenantId || tenantList[0]?.id || tenantList[0]?.tenantId || '';
|
const tenantId = claims.tenant_id || claims.tenantId || custom.tenant_id || custom.tenantId || tenantList[0]?.id || tenantList[0]?.tenantId || '';
|
||||||
|
|||||||
Reference in New Issue
Block a user