# SSO

Sign in to the console through your organization’s OpenID Connect provider.

Single sign-on (SSO) on Pro uses OpenID Connect (OIDC) for one organization at a time. Security Assertion Markup Language (SAML) federation stays on the Enterprise plan.

To wire a provider, an org owner or admin may upsert settings with `PUT /api/orgs/{id}/sso`:

```sh
curl -X PUT http://127.0.0.1:3000/api/orgs/{id}/sso \
  -H "Authorization: Bearer crt_…" \
  -H "Content-Type: application/json" \
  -d '{
    "issuer": "https://idp.example.com",
    "clientId": "…",
    "clientSecret": "…",
    "domains": ["example.com"],
    "enabled": true
  }'
```

Charter loads `/.well-known/openid-configuration` from a public host; the same SSRF rules as webhooks apply. After that, people may start sign-in at `GET /api/orgs/sso/authorize?domain=example.com`.

## Turn it on or off

SSO is on by default when organizations are on. Disable with:

```sh
CHARTER_DISABLE_SSO=1
# or
charter serve --no-sso
```

## Configure a provider

Org owners and admins upsert settings with `PUT /api/orgs/{id}/sso`:

- `issuer`: OIDC issuer URL (Charter loads `/.well-known/openid-configuration` from a public host; the same SSRF rules as webhooks apply)
- `clientId` / `clientSecret`: confidential client credentials
- `domains`: email domains that map to this org (required when `enabled` is true)
- `enabled`: whether login is live

Read with `GET /api/orgs/{id}/sso`. Delete with `DELETE /api/orgs/{id}/sso`.

## Sign in

Start the flow at:

- `GET /api/orgs/sso/authorize?domain=example.com`
- or `GET /api/orgs/sso/authorize?org_id={uuid}`

Optional `callbackURL` must be a same-site relative path (for example `/console`) or an allowed origin (same rules as social OAuth). The callback is `GET /api/orgs/sso/callback`. Charter requires a verified IdP email whose domain is on the provider list, refuses linking to operator accounts, creates or links the user, adds them as an org member when needed, and sets the session cookie.
