diff --git a/api/src/plugins/auth0.ts b/api/src/plugins/auth0.ts index 541531ac249..5b9690d0ec8 100644 --- a/api/src/plugins/auth0.ts +++ b/api/src/plugins/auth0.ts @@ -128,8 +128,12 @@ export const auth0Client: FastifyPluginCallbackTypebox = fp( const userinfo = (await fastify.auth0OAuth.userinfo(token)) as { email: string; }; + logger.info(`Auth0 userinfo: ${JSON.stringify(userinfo)}`); email = userinfo.email; - if (typeof email !== 'string') throw Error('Invalid userinfo response'); + if (typeof email !== 'string') { + const msg = `Invalid userinfo email: ${JSON.stringify(userinfo)}`; + throw Error(msg); + } } catch (error) { logger.error({ error }, 'Auth failed'); fastify.Sentry.captureException(error);