Skip to content

armgit / fx0

Public Imported from GitHub
0

A lightweight design agent built with libfx. Describe a page and an agent writes it as one HTML file.

TypeScript

Ask Vercel for the single-team consent flow

Esteban Suarez2854101c9b04
diff --git a/app/api/auth/signin/route.ts b/app/api/auth/signin/route.ts
index c2eb823..2c3480e 100644
--- a/app/api/auth/signin/route.ts
+++ b/app/api/auth/signin/route.ts
@@ -17,6 +17,8 @@ export async function GET(request: NextRequest) {
client_id: clientId, redirect_uri: `${origin}/api/auth/callback`, response_type: 'code',
scope: 'openid profile email offline_access', state: flow.state, nonce: flow.nonce,
code_challenge: pkceChallenge(flow.codeVerifier), code_challenge_method: 'S256',
+ // Each sign-in grants one team; more teams come from another consent.
+ teamSelection: 'single-team',
...(reauth ? { prompt: 'consent' } : {}),
}).toString()
const response = NextResponse.redirect(url)
diff --git a/tests/auth.test.mjs b/tests/auth.test.mjs
index c462a10..d3f9ccd 100644
--- a/tests/auth.test.mjs
+++ b/tests/auth.test.mjs
@@ -661,6 +661,7 @@ test('signin uses trusted APP_URL, required scopes and PKCE, and one encrypted s
assert.equal(url.searchParams.get('redirect_uri'), 'https://fx0.example/api/auth/callback')
assert.equal(url.searchParams.get('scope'), 'openid profile email offline_access')
assert.equal(url.searchParams.get('prompt'), 'consent')
+ assert.equal(url.searchParams.get('teamSelection'), 'single-team')
const cookie = response.cookies.get(protocol.FLOW_COOKIE_NAME)
assert.ok(cookie)
const flow = await unsealData(cookie.value, { password: process.env.SESSION_SECRET, ttl: protocol.FLOW_TTL_SECONDS })