mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-25 04:00:43 -04:00
chore(api): add more auth0 plugin logs (#60398)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user