File: keycloak.md | Updated: 11/15/2025
š NextAuth.js is now part of Better Auth !
Version: v4
On this page
Documentationā
https://www.keycloak.org/docs/latest/server_admin/#_oidc_clients
Configurationā
tip
Create an openid-connect client in Keycloak with "confidential" as the "Access Type".
Optionsā
The Keycloak Provider comes with a set of default options:
You can override any of the options to suit your own use case.
Exampleā
import KeycloakProvider from "next-auth/providers/keycloak";...providers: [ KeycloakProvider({ clientId: process.env.KEYCLOAK_ID, clientSecret: process.env.KEYCLOAK_SECRET, issuer: process.env.KEYCLOAK_ISSUER, })]...
note
issuer should include the realm āĀ e.g. https://my-keycloak-domain.com/realms/My_Realm