diff --git a/apps/client-ts/src/app/connections/layout.tsx b/apps/client-ts/src/app/connections/layout.tsx index a5113a515..21320d008 100644 --- a/apps/client-ts/src/app/connections/layout.tsx +++ b/apps/client-ts/src/app/connections/layout.tsx @@ -16,11 +16,11 @@ export default function Layout({ }>) { const { session } = useStytchSession(); const router = useRouter(); - /*useEffect(() => { + useEffect(() => { if(config.DISTRIBUTION !== "selfhost" && !session){ router.push("/b2c/login"); } - }, [session, router]);*/ + }, [session, router]); return ( <> diff --git a/apps/client-ts/src/middleware.ts b/apps/client-ts/src/middleware.ts index d651637e9..071aaaf20 100644 --- a/apps/client-ts/src/middleware.ts +++ b/apps/client-ts/src/middleware.ts @@ -170,12 +170,12 @@ export async function middleware(request: NextRequest) { if(request.nextUrl.pathname.startsWith('/api/logout')){ const response = NextResponse.redirect(new URL("/b2c/login", request.url)); - const sessionJWT = request.cookies.get("session")?.value; + const sessionJWT = request.cookies.get("stytch_session_jwt")?.value; if (!sessionJWT) { return; } // Delete the session cookie by setting maxAge to 0 - response.cookies.set("session", "", { maxAge: 0 }); + response.cookies.set("stytch_session_jwt", "", { maxAge: 0 }); // Call Stytch in the background to terminate the session // But don't block on it! stytchClient.sessions