docs(app): explain route proxy authentication and page composition

This commit is contained in:
2026-11-12 01:41:22 +08:00
parent aacafa7a9b
commit 86dac408c3
9 changed files with 92 additions and 0 deletions
+7
View File
@@ -1,5 +1,11 @@
/**
* 第三方登录的服务端跳转入口。只接受固定provider及单一PKCE challenge,
* 重定向到配置的Foundry项目,不交换令牌、不读取verifier,也不在此创建会话Cookie。
*/
import { NextRequest, NextResponse } from "next/server";
/** await异步provider参数,challenge须为43字符base64url;多值或未知provider直接400。
* 302显式no-store,避免浏览器把某一次登录challenge的跳转当成可复用响应。 */
export async function GET(
req: NextRequest,
{ params }: { params: Promise<{ provider: string }> },
@@ -13,6 +19,7 @@ export async function GET(
!/^[-_a-zA-Z0-9]{43}$/.test(challenge)
)
return NextResponse.json({ error: "invalid_request" }, { status: 400 });
// 上游源站/项目由宿主环境装配,不让查询参数决定任意OAuth重定向目标。
const origin = process.env.FOUNDRY_API_ORIGIN || "https://api.foundry.entroia.com";
const project = process.env.NEXT_PUBLIC_FOUNDRY_PROJECT || "endoleap";
return NextResponse.redirect(