Keycloak Provider
Resources
Setup
Callback URL
https://example.com/api/auth/callback/keycloak
Environment Variables
AUTH_KEYCLOAK_ID
AUTH_KEYCLOAK_SECRET
AUTH_KEYCLOAK_ISSUER
Configuration
/auth.ts
import NextAuth from "next-auth"
import Keycloak from "next-auth/providers/keycloak"
export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [Keycloak],
})
Enable the “Client Authentication” option to retrieve your client secret in the Credentials tab.
Prior to v20, create an openid-connect
client in Keycloak with “confidential” as the “Access Type”.
- Issuer should include the realm – e.g.
https://my-keycloak-domain.com/realms/My_Realm