debug: add ?debug=1 endpoint to theia-auth for cookie inspection

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-18 16:57:49 -08:00
parent 28cd9dd776
commit 008b04d2dd

View File

@@ -29,6 +29,13 @@ const SESSION_COOKIE_NAMES = [
];
export async function GET(request: NextRequest) {
// Debug: when called with ?debug=1, reveal which cookies were received
if (request.nextUrl.searchParams.get('debug') === '1') {
const cookieHeader = request.headers.get('cookie') ?? '(none)';
const allNames = [...request.cookies.getAll()].map(c => c.name);
return NextResponse.json({ cookieHeader: cookieHeader.slice(0, 200), parsedNames: allNames });
}
// Extract session token from cookies
let sessionToken: string | null = null;
for (const name of SESSION_COOKIE_NAMES) {