Skip to content

Commit e0419ac

Browse files
committed
fix
1 parent 2b130a0 commit e0419ac

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/lib/auth.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,18 @@ export const authConfig: NextAuthConfig = {
3131
scope: "openid profile email",
3232
},
3333
},
34-
token: "https://slack.com/api/openid.connect.token",
34+
token: {
35+
url: "https://slack.com/api/openid.connect.token",
36+
async conform(response: Response) {
37+
const data = await response.json();
38+
// Strip id_token — Slack's OIDC returns a broken nonce, and Auth.js
39+
// tries to validate it even with type "oauth". Removing it forces
40+
// Auth.js to use the userinfo endpoint instead.
41+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
42+
const { id_token, ...rest } = data;
43+
return Response.json(rest);
44+
},
45+
},
3546
userinfo: "https://slack.com/api/openid.connect.userInfo",
3647
profile(profile) {
3748
return {

0 commit comments

Comments
 (0)