fix SSO
CI/CD (dev on branch, prod on tag) / setup (push) Canceled after 0s
CI/CD (dev on branch, prod on tag) / build-and-deploy (push) Canceled after 0s

This commit is contained in:
s871077
2026-09-22 10:39:17 +08:00
parent 167eb0807d
commit a79a01437a
3 changed files with 18 additions and 1 deletions
+12
View File
@@ -20,6 +20,18 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
clientSecret: process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET,
// Tenant-specific issuer restricts sign-in to our organization only.
issuer: process.env.AUTH_MICROSOFT_ENTRA_ID_ISSUER,
// The provider's default profile() pulls the Graph photo and inlines it as a
// base64 data-URI into user.image -> the `picture` JWT claim. Since sessions
// are JWTs, that becomes a multi-KB chunked session cookie whose combined
// Cookie header overflows nginx's proxy buffer -> 502 before the request ever
// reaches this app. We never render an avatar, so keep the token lean.
authorization: { params: { scope: "openid profile email" } },
profile: (profile) => ({
id: profile.sub,
name: profile.name,
email: profile.email,
image: null,
}),
}),
Credentials({
name: "Local account",