diff --git a/plugins/auth-backend-module-auth0-provider/src/authenticator.ts b/plugins/auth-backend-module-auth0-provider/src/authenticator.ts index 471e5ce892..8c8b200793 100644 --- a/plugins/auth-backend-module-auth0-provider/src/authenticator.ts +++ b/plugins/auth-backend-module-auth0-provider/src/authenticator.ts @@ -138,7 +138,10 @@ export function createAuth0Authenticator(options?: { cache?: CacheService }) { input.scope, ); - const cacheKey = `auth0-profile:${input.refreshToken}`; + const sub = JSON.parse( + Buffer.from(result.params.id_token.split('.')[1], 'base64').toString(), + ).sub; + const cacheKey = `auth0-profile:${sub}`; let fullProfile = (await profileCache?.get(cacheKey)) as | PassportProfile | undefined;