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,