feat(api): enhance logging for mobile login endpoint (#59159)

This commit is contained in:
Sem Bauke
2025-03-25 03:05:32 +01:00
committed by GitHub
parent c51218d3b1
commit 59dda94259
+8
View File
@@ -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'