Last active
June 1, 2023 15:02
-
-
Save vincentchalamon/505fd869ab72bbdf5a0636991aae2643 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import NextAuth from "next-auth" | |
import KeycloakProvider from "next-auth/providers/keycloak" | |
export const authOptions = { | |
// Configure one or more authentication providers | |
providers: [ | |
KeycloakProvider({ | |
id: 'keycloak', | |
clientId: process.env.OIDC_CLIENT_ID, | |
issuer: process.env.OIDC_SERVER_URL, | |
authorization: { | |
// https://authjs.dev/guides/basics/refresh-token-rotation#jwt-strategy | |
params: { | |
access_type: "offline", | |
prompt: "consent", | |
}, | |
}, | |
// https://github.com/nextauthjs/next-auth/issues/685#issuecomment-785212676 | |
protection: "pkce", | |
// https://github.com/nextauthjs/next-auth/issues/4707 | |
// @ts-ignore | |
clientSecret: null, | |
client: { | |
token_endpoint_auth_method: "none" | |
}, | |
}), | |
], | |
} | |
export default NextAuth(authOptions) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment