diff --git a/api/src/routes/public/auth.ts b/api/src/routes/public/auth.ts index fcc67f216a4..b4d31d94541 100644 --- a/api/src/routes/public/auth.ts +++ b/api/src/routes/public/auth.ts @@ -43,13 +43,21 @@ export const mobileAuth0Routes: FastifyPluginCallback = ( fastify.get('/mobile-login', async (req, reply) => { const email = await getEmailFromAuth0(req); + const logger = fastify.log.child({ req }); + + logger.info('Mobile app login attempt'); + if (!email) { + logger.error('Could not get email from Auth0 to log in'); + return reply.status(401).send({ message: 'We could not log you in, please try again in a moment.', type: 'danger' }); } if (!isEmail(email)) { + logger.error('Email is incorrectly formatted for login'); + return reply.status(400).send({ message: 'The email is incorrectly formatted', type: 'danger'