multica/apps/web/app/api/desktop/session/route.ts
Naiyuan Qing 108cf7ffb0 feat(web): add login page for desktop auth callback
- Add email/code login with verification
- Add Google OAuth login
- Add desktop callback API route
- Add request service with device ID handling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 12:25:03 +08:00

23 lines
796 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { NextRequest, NextResponse } from 'next/server';
/**
* Desktop Session API
*
* 参考Cap/apps/web/app/api/desktop/[...route]/session.ts
*
* 流程:
* 1. Desktop 打开这个 URL带 port 或 platform 参数)
* 2. 直接重定向到 /login?next=当前URL
* 3. 用户登录后login 页面会重定向到 Desktop 回调
*
* 注意Web 端不做任何 SID 缓存,每次都要重新登录
*/
export async function GET(request: NextRequest) {
// Build current URL for next parameter
const currentUrl = request.nextUrl.toString();
// Always redirect to login page - no caching, always require fresh login
const loginUrl = new URL('/login', request.nextUrl.origin);
loginUrl.searchParams.set('next', currentUrl);
return NextResponse.redirect(loginUrl);
}