From dca64fe84b3713c379aa7aa2239a89106b80a869 Mon Sep 17 00:00:00 2001 From: DandrewsDev Date: Thu, 18 May 2023 09:09:08 -0400 Subject: [PATCH] Update providerId to fallback to id in the absence of a sub field. (#5343) --- plugins/oidc/server/auth/oidc.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/oidc/server/auth/oidc.ts b/plugins/oidc/server/auth/oidc.ts index 55c8234ed..cda07f4f5 100644 --- a/plugins/oidc/server/auth/oidc.ts +++ b/plugins/oidc/server/auth/oidc.ts @@ -111,6 +111,7 @@ if ( // Default is 'preferred_username' as per OIDC spec. const username = get(profile, env.OIDC_USERNAME_CLAIM); const name = profile.name || username || profile.username; + const providerId = profile.sub ? profile.sub : profile.id; if (!name) { throw AuthenticationError( @@ -137,7 +138,7 @@ if ( providerId: domain, }, authentication: { - providerId: profile.sub, + providerId, accessToken, refreshToken, expiresIn: params.expires_in,