From 3887845611723d9a64832afd71e4185d9fd8dc58 Mon Sep 17 00:00:00 2001 From: youngkidwarrior Date: Fri, 19 Jul 2024 16:14:23 -0700 Subject: [PATCH] Don't let auth redirects set redirectUri --- apps/next/utils/userProtected.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/next/utils/userProtected.ts b/apps/next/utils/userProtected.ts index b348675e4..33b43d0cd 100644 --- a/apps/next/utils/userProtected.ts +++ b/apps/next/utils/userProtected.ts @@ -28,9 +28,11 @@ export function userProtectedGetSSP< if (!session) { log('no session') - const destination = ctx.req.url - ? `/auth/sign-in?redirectUri=${encodeURIComponent(ctx.req.url)}` - : '/auth/sign-in' + const destination = + ctx.req.url === undefined || ctx.req.url.includes('/auth') + ? '/auth/sign-in' + : `/auth/sign-in?redirectUri=${encodeURIComponent(ctx.req.url)}` + return { redirect: { destination,