Keycloak
Setup Keycloak
- Log in to the Keycloak Admin Interface and navigate to Clients. Make sure you have first selected the correct Realm.
- Click Create client.
- Select Client Type OpenID Connect and enter a client id. Click Next.
- In the Capability config step, enable Client Authentication. Click Save.
- Scroll down to the Access settings section and configure the Valid redirect URIs.
Specify the public URL of your application and append the path
/oidc/callback
.
Eg.:https://my-app.mydomain.com/oidc/callback
. - Enter the same for Valid post logout redirect URIs.
- In Web Origins enter a
+
and click Save.
Middleware Configuration
tip
You will find the client secret on the Credentials tab within your Keycloak client.
http:
middlewares:
oidc-auth:
plugin:
traefik-oidc-auth:
Provider:
Url: "https://login.my-keycloak.com/realms/<myRealm>"
ClientId: "<YourClientId>"
ClientSecret: "<YourClientSecret>"
UsePkce: true
ValidAudience: "account"
Scopes: ["openid", "profile", "email"]
note
You need to set ValidAudience
to account
. I don't really know why Keycloak tokens always contain the account
audience.