chore(api): add more auth0 plugin logs (#60398)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Shaun Hamilton
2025-05-16 12:47:47 +02:00
committed by GitHub
parent a7b0e90f28
commit 3a146ec946

View File

@@ -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);