Single sign-on
Let people and services call your self-hosted Claude Managed Agents server with tokens from your identity provider.
By default, your server accepts one shared key, the server API key. With single sign-on, each person or service can also call the server with a token from your OpenID Connect (OIDC) identity provider. The server gives the caller a role from the groups in the token. The server API key keeps working as an administrator credential.
This page shows how to add your identity provider, what each role can do, and how to let developers log in from a terminal.
Add your identity provider
Register the server in your identity provider
Register the server as an API with an identifier such as
api://cma-server, and have clients request tokens for it.List the identity provider in the settings file
Add an entry under
auth.issuersin the settings file:auth: issuers: - name: okta issuer_url: https://login.example.com/oauth2/default audiences: [api://cma-server] roles: - group: cma-admins role: admin - group: "eng-*" role: developernamelabels the issuer in log lines, and the server records it as part of the creator of each resource. Don’t change it once people have created resources.issuer_urlmust equal theissclaim of your tokens.audienceslists the values that a token’saudclaim can carry, such as the identifier from the first step.rolesmaps a group toadmin,developer, oruser. The highest matching role wins.
For the other fields, see Issuer entries. If your provider is Microsoft Entra ID, also see Microsoft Entra ID.
Restart the server and check sign-in
Restart the server. A caller sends the token as
Authorization: Bearer <token>, on any route that accepts the server API key.For every request that a token authenticated, the server logs
auth=oidc, the issuer’sname, and the caller’s subject (sub=).
If sign-in fails
| Response | Cause | The server’s log line contains |
|---|---|---|
401, the same as for a wrong API key | The token failed a check. The log line has the reason. | oidc token |
403 | The token’s groups match no roles entry | token holds no role |
Microsoft Entra ID
Entra ID differs from other providers in two ways. Both settings go in the issuer entry:
- The person: Entra ID gives a person a different
subin each client application, so the default would record one person as several creators. Setsubject_claim: oid. - The groups: Entra ID leaves the
groupsclaim out of a token if the person belongs to many groups. That person then matches norolesentry. To prevent this, have Entra ID emit only the groups assigned to the application. Or assign app roles to people in Entra ID, and setgroups_claim: rolesso that the server reads app roles in place of groups.
What each role can do
| Role | Agents, skills, sessions, vaults, and memory stores | Environments |
|---|---|---|
admin, and the server API key | Sees and changes everything | Creates, changes, and deletes them, and creates their keys |
developer or user | Sees and changes only what that caller created | Lists them, reads them, and runs sessions in them |
developer and user have the same access. A caller with either role:
- Can’t see a resource that someone else created. The resource is absent from lists, and a request for its ID gets the same answer as a request for an unknown ID. That includes everything created with the server API key before you turned on single sign-on.
- Can’t share a resource with another caller or a group.
Map admin to exact group names. An administrator can also start a session that uses any user’s vault. So give the role only to groups that you trust with every user’s MCP tokens.
Let developers log in from a terminal
Developers can log in through your identity provider and then use the ant CLI under their own identity, without the server API key. You do the first two steps, and each developer does the third.
Register an application in your identity provider
Register a native (“public”) application that has:
- No client secret
- The authorization code grant with PKCE
- The redirect URI
http://127.0.0.1/callback
Some providers need one of the other redirect URIs.
Add the application to the issuer entry
Add
login_client_idandlogin_scopesto the issuer entry, and restart the server:login_client_id: 0oa1b2c3d4e5f6g7h8i9 login_scopes: [openid, cma-server.access]login_scopeslists the scopes that your provider needs to issue a token whoseaudclaim is in the issuer entry’saudienceslist.Log in
Each developer runs the login from the top of the extracted archive:
./cma-server-admin login https://cma.example.comThe server’s URL must be
https://, orhttp://tolocalhost,127.0.0.1, or::1. With one of the other redirect URIs, add its flag to the command.The command opens the provider’s sign-in page in a browser and then writes an
antCLI profile namedcma-server. Pass--profile cma-serverto anyantcommand, or runant profile activate cma-serverto make the profile the default.
When the token expires, the developer runs login again. To have the ant CLI renew the token instead, add offline_access to login_scopes.
Other redirect URIs
| Provider | Redirect URI to register | Flag that developers add to the login command |
|---|---|---|
| Microsoft Entra ID | http://localhost/callback | -listen localhost:0 |
| One that requires the port in the redirect URI | A URI with a fixed port, such as http://127.0.0.1:8123/callback | -listen 127.0.0.1:8123 |
To list the other flags, add -h to the login command.
Let people sign in to the console on your server
The console on your server signs people in through the application that you registered for the terminal login. To finish its setup, see Set up sign-in.
Was this page helpful?