From f836b72e86d538f6f942c9d3652146a75a92eae7 Mon Sep 17 00:00:00 2001 From: jamesschuler Date: Mon, 29 May 2023 21:37:47 -0700 Subject: [PATCH] More error logging --- api/src/middleware/auth.middleware.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/src/middleware/auth.middleware.ts b/api/src/middleware/auth.middleware.ts index 19c8227..3f74598 100644 --- a/api/src/middleware/auth.middleware.ts +++ b/api/src/middleware/auth.middleware.ts @@ -26,19 +26,21 @@ export async function validateAccessToken(ctx: RouterContext, next: () = return; } + let errorMessage = "No access token found in session."; const storedAccessToken: string = await ctx.state.session.get("accessToken"); if (!isNullOrUndefined(storedAccessToken)) { const result = await compareValues(accessToken!, storedAccessToken); if (result) { await next(); return; + } else { + errorMessage = "Access Tokens don't match"; } } + await logError(errorMessage, ctx.state.session); await ctx.state.session.deleteSession(); - await logError("No access token found in session."); - handleErrorResponse(ctx, null, Status.Unauthorized); }