Keycloak SSO for Argo CD
Sign in to Argo CD with Keycloak over OpenID Connect, send Keycloak groups in a groups claim, and map them to Argo CD roles in argocd-rbac-cm.
Argo CD talks to Keycloak directly through its built-in OIDC support, without Dex. You set it up in the argocd-cm ConfigMap, keep the client secret in argocd-secret, and grant access by group in argocd-rbac-cm.
Checked against Argo CD 3.6 docs and Keycloak 26.8 on 25 November 2026.
Replace auth.example.com with your RealmDeploy hostname and acme with your realm. The examples use https://argocd.example.com for Argo CD and the argocd namespace.
Argo CD's Keycloak guide offers two setups:
- Client authentication (below): a confidential client with a secret. Login works in the web UI.
- PKCE: a public client without a secret. Choose it if people also sign in with the
argocdCLI; see Use the argocd CLI.
In Keycloak
Create the client
Open Clients, choose Create client, and use these values:
| Setting | Value |
|---|---|
| Client type | OpenID Connect |
| Client ID | argocd |
| Client authentication | On |
| Authentication flow | Standard flow only |
| Root URL | https://argocd.example.com |
| Home URL | /applications |
| Valid redirect URIs | https://argocd.example.com/auth/callback |
| Valid post logout redirect URIs | https://argocd.example.com |
| Web origins | https://argocd.example.com |
Choose Save, then copy the secret from the Credentials tab.
Argo CD's Keycloak guide also sets Admin URL. Leave it empty. Keycloak uses that URL to call the app from your tenant, and outgoing connections from your tenant are closed by default. Argo CD does not need it.
Add a groups client scope
Keycloak has no built-in groups scope, so create one, as Argo CD's guide does:
- Open Client scopes and choose Create client scope.
- Enter the Name
groups, keep Protocol on OpenID Connect, and choose Save. - On its Mappers tab, choose Configure a new mapper and pick Group Membership.
- Fill it in and choose Save:
| Field | Value |
|---|---|
| Name | groups |
| Token Claim Name | groups |
| Full group path | Off |
| Add to ID token | On |
- Open the
argocdclient, go to its Client scopes tab, choose Add client scope, selectgroups, and add it as Default.
Then create a group, for example ArgoCDAdmins, under Groups and add your user to it.
In Argo CD
Store the client secret in argocd-secret under a key of your choice:
kubectl -n argocd patch secret argocd-secret \
--patch='{"stringData": {"oidc.keycloak.clientSecret": "CLIENT_SECRET_FROM_KEYCLOAK"}}'Then set url and oidc.config in argocd-cm:
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
namespace: argocd
labels:
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
data:
url: https://argocd.example.com
oidc.config: |
name: Keycloak
issuer: https://auth.example.com/realms/acme
clientID: argocd
clientSecret: $oidc.keycloak.clientSecret
requestedScopes: ["openid", "profile", "email", "groups"]
refreshTokenThreshold: 2m
logoutURL: https://auth.example.com/realms/acme/protocol/openid-connect/logout?id_token_hint={{token}}&post_logout_redirect_uri={{logoutRedirectURL}}Apply it with kubectl apply -f argocd-cm.yaml, or edit the live object with kubectl -n argocd edit configmap argocd-cm. Keep the app.kubernetes.io/part-of: argocd label: Argo CD ignores ConfigMaps without it.
| Setting | Meaning |
|---|---|
url | Argo CD's public address. Argo CD builds the callback https://argocd.example.com/auth/callback from it. |
issuer | Your realm. Argo CD reads the discovery document under it and checks the iss claim. |
clientID | Argo CD also checks that the ID token's aud is this client ID, which is what Keycloak puts there. |
clientSecret | $oidc.keycloak.clientSecret tells Argo CD to read that key from argocd-secret. |
requestedScopes | Includes groups. Because groups is a default scope on the client, Keycloak adds the claim either way. |
refreshTokenThreshold | Argo CD refreshes the token this long before it expires. Keep it below the token lifespan; Keycloak's default access token lifespan is 5 minutes. |
logoutURL | Keycloak's logout endpoint. Argo CD fills in {{token}} with the ID token and {{logoutRedirectURL}} with its own base URL, which must be in Valid post logout redirect URIs. |
The login page now shows Log in via Keycloak.
Groups and roles
Argo CD reads the groups claim and matches it against g lines in argocd-rbac-cm:
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-rbac-cm
namespace: argocd
labels:
app.kubernetes.io/name: argocd-rbac-cm
app.kubernetes.io/part-of: argocd
data:
policy.default: role:readonly
policy.csv: |
g, ArgoCDAdmins, role:admin| Setting | Meaning |
|---|---|
g, ArgoCDAdmins, role:admin | Members of the Keycloak group ArgoCDAdmins get Argo CD's built-in role:admin. |
policy.default | The role every signed-in user gets. Leave it out to give users without a matching group no access. |
scopes | Which claims Argo CD checks for groups. It defaults to [groups], so you do not need to set it. |
The group name in policy.csv must match the claim exactly. With Full group path off, the claim is ArgoCDAdmins. With it on, Keycloak sends /ArgoCDAdmins, and that is what you would have to write.
Use the argocd CLI
Argo CD's Keycloak guide says the CLI needs the PKCE setup. Change the client and the config like this:
| In Keycloak | Value |
|---|---|
| Client authentication | Off |
| Valid redirect URIs | https://argocd.example.com/auth/callback, https://argocd.example.com/pkce/verify and http://localhost:8085/auth/callback |
| PKCE Method (Settings tab, Capability config) | S256 |
8085 is the CLI's default --sso-port. In argocd-cm, drop clientSecret and turn on PKCE:
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
namespace: argocd
labels:
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
data:
url: https://argocd.example.com
oidc.config: |
name: Keycloak
issuer: https://auth.example.com/realms/acme
clientID: argocd
enablePKCEAuthentication: true
requestedScopes: ["openid", "profile", "email", "groups"]
refreshTokenThreshold: 2m
logoutURL: https://auth.example.com/realms/acme/protocol/openid-connect/logout?id_token_hint={{token}}&post_logout_redirect_uri={{logoutRedirectURL}}Then sign in from a terminal. The CLI listens on localhost:8085 and opens the browser:
argocd login argocd.example.com --sso --grpc-webTest it
- Open
https://argocd.example.comin a private window and choose Log in via Keycloak. - Sign in as a member of
ArgoCDAdmins. Open User Info in the left menu: it lists your groups, and you can change settings. - Sign in as a user outside the group. With
policy.default: role:readonlythey can look but not change anything. - To see the claims Argo CD receives, open the
argocdclient in Keycloak, go to Client scopes → Evaluate, pick the user and look at Generated ID token. Paste it into the JWT decoder. - Log out. You land on Keycloak's logout and then back on Argo CD.
Common errors
| Error | Cause | Fix |
|---|---|---|
Invalid parameter: redirect_uri on the Keycloak page | url in argocd-cm and Valid redirect URIs differ. | Set url to the public address and list https://argocd.example.com/auth/callback exactly. Check with the redirect URI matcher. |
| Logged in, but every action is denied | The groups claim is missing or does not match policy.csv. | Check the ID token in Client scopes → Evaluate. Turn off Full group path, or write the group with its leading slash. |
invalid_request: Missing parameter: code_challenge_method | You moved from client authentication to PKCE and the browser still has the old flow. | Try a private window or clear the cookies, as Argo CD's guide suggests. |
| 401 or a login loop after changing the config | argocd-server still uses the old settings. | Restart it: kubectl -n argocd rollout restart deployment argocd-server. |
invalid_client | Wrong secret, or the key in argocd-secret does not match $oidc.keycloak.clientSecret. | Patch the secret again. Look up other codes in the OAuth error lookup. |
Invalid redirect uri on logout | Argo CD's base URL is not in Valid post logout redirect URIs. | Add https://argocd.example.com. Build a test URL with the logout URL builder. |
FAQ
Do I need Dex?
No. With oidc.config, Argo CD talks to Keycloak directly. Argo CD's docs suggest Dex for providers that do not support OpenID Connect, or for Dex's own connector features.
Can I keep the local admin account?
Yes. Argo CD's docs recommend disabling it once other users exist, with admin.enabled: "false" in argocd-cm. Make sure an SSO user has role:admin first.
Why does the session end after a few minutes?
The ID token expired and Argo CD could not refresh it. Keep refreshTokenThreshold below Keycloak's token lifespan.
Sources
- Argo CD, Keycloak: https://argo-cd.readthedocs.io/en/stable/operator-manual/user-management/keycloak/
- Argo CD, Overview of user management (OIDC configuration, logoutURL): https://argo-cd.readthedocs.io/en/stable/operator-manual/user-management/
- Argo CD, RBAC configuration: https://argo-cd.readthedocs.io/en/stable/operator-manual/rbac/
- Argo CD 3.6.3 release: https://github.com/argoproj/argo-cd/releases/tag/v3.6.3
- Keycloak Server Administration Guide, client settings, client scopes and protocol mappers: https://www.keycloak.org/docs/latest/server_admin/
Keycloak SSO for GitLab
Sign in to GitLab Self-Managed with Keycloak through the OmniAuth OpenID Connect provider, and use Keycloak groups for admin and external users.
Keycloak SSO for HashiCorp Vault
Sign in to the Vault UI and CLI with Keycloak through Vault's OIDC auth method, and give Keycloak groups Vault policies with external groups.