Files
coder/docs/tutorials/configuring-okta.md
T
Nick Vigilante 16551fd67f feat: enable Coder.AbbreviationFirstUse (#30878)
Adds `Coder.AbbreviationFirstUse`, a Vale rule that requires each
abbreviation to be expanded on its first use on a page, in the form
"Expanded Form (ABBR)". It supports [WCAG 2.2 Level AAA Success
Criterion 3.1.4
(Abbreviations)](https://www.w3.org/TR/WCAG22/#abbreviations). Following
the "Adding a Vale rule" pattern in `docs/.style/README.md`, the PR has
two commits: the cleanup first, then the enable.

## Cleanup commit

431 first uses expanded across 167 pages, so the rule ships with zero
findings across `docs/`, excluding `docs/.style/style-guide/`. The
branch was rebuilt on current `main`, so pages added or moved since the
first draft are covered.

- Where the first use is a bold UI label (**CA Path**, **Add redirect
URI**, **Redirect URI**), the label stays as the UI shows it and the
expansion goes elsewhere in the same paragraph or list item.
- Reversed forms such as "PKCE (Proof Key for Code Exchange)" are
flipped to the expanded-first form.
- A few sentences took a small rewording to fit the expansion: list
steps that would pass the 20-word limit (`Coder.StepLength`), and spots
where the expansion would nest parentheses.
- MITM is expanded as "machine-in-the-middle" rather than
"man-in-the-middle". Every use describes the AI Gateway Proxy
intercepting traffic on purpose, so "on-path attacker" doesn't fit. The
inclusive-language table on `accessibility-and-inclusion.md` gains the
substitution: "on-path attacker" for the attack, "machine-in-the-middle"
for the feature.
- Unrelated fixes on lines already being edited: `DERP MAP` → `DERP
map`, and `ENV` → "environment variable" in `faqs.md`.

## Enable commit

**Rule design.** The rule is a `conditional`. `first` matches 2 to 6
capitals, each optionally followed by digits (`EC2`, `P2P`), and a
lookahead lets a plural `s` count as a use of the singular. `second`
captures the abbreviation in `word (ABBR)`, including `(CI/CD)` and
`(PCI DSS)` pairs. Vale collects the captures across the page's blocks
in document order, so a later expansion doesn't cover an earlier use.
Within a single paragraph, list item, or table cell, an expansion
anywhere in the block counts.

**Scope.** `scope: ~heading` skips headings, because a page title often
names an abbreviation that the first paragraph then expands. Vale
already skips front matter, code blocks, inline code, and link URLs.
`.vale.ini` turns the rule off for the pages generated from Go source
that `Coder.UnitSpacing` already skips: `docs/reference/{api,cli}/*.md`,
`configuration-reference.md`, and `prometheus.md`.

**Severity: `warning`.** Whether an abbreviation is familiar enough to
skip is a judgment call, so this is guidance with legitimate exceptions,
not hard policy.

**Exceptions**, each group commented in the rule file:

| Group | Entries | Reason |
| --- | --- | --- |
| Known to every reader | AI, API, AWS, CLI, CPU, DNS, GCP, HTTP(S), ID,
IDE, IP, JSON, OS, PR, RAM, SDK, SQL, SSH, TLS, UI, URL, VM, YAML |
Abbreviations every reader of the docs knows. Plurals such as VMs and
SDKs pass too |
| Units, clock times, file and package formats | GB, KB, MB, AM, PM,
CSV, GIF, JPEG, PDF, PNG, RPM, SVG, VSIX, ZIP | Readers know these by
the abbreviation, not the expansion |
| Not abbreviations | NOTE, TIP, OK, README, SKILL, ALL, AND, ANY,
ERROR, MUST, NOT, ON, OR, DELETE, GET, POST, PUT, ILIKE, VACUUM, LOGIN,
PLAIN, NUL, CRON, TERM, DOCS, `DOC\d+`, `RFC\d+`, TL, DR | Alert labels,
file names, emphasis in capitals, HTTP methods, SQL keywords, SMTP auth
mechanisms, rule labels in `docs/AGENTS.md`, RFC numbers, TL;DR |
| Names written in capitals | VS, IDEA, IU, NGINX, SUSE, GNU, XFCE, DX,
IBM, DCV, TRAMP, MSYS2, NET, VSX, ARM, AMD, GPT, AES, GCM, HMAC, HS256,
RSA, SHA, SHA256 | The capitals are the product, company, or algorithm
name (VS Code, IntelliJ IDEA, .NET, Open VSX, Amazon DCV, AMD) |

The "known to every reader" group is the list that needs judgment, and
it's the one to push back on. The other groups only stop the regex from
treating words and names as abbreviations.

**Documentation.** A new "Expand abbreviations on first use" section on
`accessibility-and-inclusion.md`, and the style guide README's checks
table, coverage table, and rule counts (90 → 91 rules, 22 → 23
tool-checked).

## Known limits

- The rule checks that an expansion exists, not that it's correct: any
word followed by `(ABBR)` satisfies it.
- An abbreviation in an image's alt text is checked before the paragraph
around it, so one alt text (`aws-marketplace.md`) carries its own
expansion.
- Some expansions read heavily in dense table cells and inline lists,
for example the four Kubernetes services in `docker-in-workspaces.md`.
They're correct, but a reviewer may prefer adding a specific
abbreviation to the exceptions instead.

## Testing

- `vale docs/` (Vale 3.7.1 through mise): zero
`Coder.AbbreviationFirstUse` findings. Findings from every other rule
match `main` file for file.
- `pnpm run format-docs`, `pnpm run lint-docs`,
`scripts/check_emdash.sh`, and `make lint/prose` run clean, and the
repository pre-commit hooks (including `lint/style-claims`) pass on both
commits.

Linear: DOCS-1311

Generated by Coder Agents on behalf of @nickvigilante.
2026-11-02 14:41:15 -05:00

7.5 KiB

title
title
Configure custom claims/scopes with Okta for group/role
Updated: June, 2025

Okta is an identity provider that can be used for OpenID Connect (OIDC) Single Sign On (SSO) on Coder.

To configure custom claims in Okta to support syncing roles and groups with Coder, you must first have setup an Okta application with OIDC working with Coder. From here, we will add additional claims for Coder to use for syncing groups and roles.

You may use a hybrid of the following approaches.

(Easiest) Sync using Okta Groups

If the Coder roles & Coder groups can be inferred from Okta groups, Okta has a simple way to send over the groups as a claim in the id_token payload.

In Okta, go to the application Sign On settings page.

Applications > Select Application > General > Sign On

In the OpenID Connect ID Token section, turn on Groups Claim Type and set the Claim name to groups. Optionally, configure a filter for which groups to be sent.

Important

If the user does not belong to any groups, the claim will not be sent. Make sure the user authenticating for testing is in at least one group.

Okta OpenID Connect ID Token

Configure Coder to use these claims for group sync. These claims are present in the id_token. For more group sync configuration options, consult the identity provider (IDP) sync documentation.

# Add the 'groups' scope and include the 'offline_access' scope for refresh tokens
CODER_OIDC_SCOPES=openid,profile,email,offline_access,groups
# This name needs to match the "Claim name" in the configuration above.
CODER_OIDC_GROUP_FIELD=groups

Note

The offline_access scope is required in Coder v2.23.0+ to prevent hourly session timeouts.

These groups can also be used to configure role syncing based on group membership:

CODER_OIDC_SCOPES=openid,profile,email,offline_access,groups
# This name needs to match the "Claim name" in the configuration above.
CODER_OIDC_USER_ROLE_FIELD=groups
# Example configuration to map a group to some roles
CODER_OIDC_USER_ROLE_MAPPING='{"admin-group":["template-admin","user-admin"]}'

(Easy) Mapping Okta profile attributes

If roles or groups cannot be completely inferred from Okta group memberships, another option is to source them from a user's attributes. The user attribute list can be found in Directory > Profile Editor > User (default).

Coder can query an Okta profile for the application from the /userinfo OIDC endpoint. To pass attributes to Coder, create the attribute in your application, then add a mapping from the Okta profile to the application.

Directory > Profile Editor > {Your Application} > Add Attribute

Create the attribute for the roles, groups, or both. Make sure the attribute is of type string array:

Okta Add Attribute view

On the Okta User to {Your Application} tab, map a roles or groups attribute you have configured to the application:

Okta Add Claim view

Configure using these new attributes in Coder:

# This must be set to false. Coder uses this endpoint to grab the attributes.
CODER_OIDC_IGNORE_USERINFO=false
# Include offline_access for refresh tokens
CODER_OIDC_SCOPES=openid,profile,email,offline_access
# Configure the group/role field using the attribute name in the application.
CODER_OIDC_USER_ROLE_FIELD=approles
# See our docs for mapping okta roles to coder roles.
CODER_OIDC_USER_ROLE_MAPPING='{"admin-group":["template-admin","user-admin"]}'

# If you added an attribute for groups, set that here.
# CODER_OIDC_GROUP_FIELD=...

Note

The offline_access scope is required in Coder v2.23.0+ to prevent hourly session timeouts.

(Advanced) Custom scopes to retrieve custom claims

Okta does not support setting custom scopes and claims in the default authorization server used by your application. If you require this functionality, you must create (or modify) an authorization server.

To see your custom authorization servers go to Security > API. Note the default authorization server is not the authorization server your app is using. You can configure this default authorization server, or create a new one specifically for your application.

Authorization servers also give more refined controls over things such as token/session lifetimes.

Okta API view

To get custom claims working, map them to a custom scope. Select the authorization server you wish to use (likely just using the default).

Go to Scopes, and Add Scope. Feel free to create one for roles, groups, or both:

Okta Add Scope view

Create the claim to go with the said scope. Go to Claims, then Add Claim. Make sure to select ID Token for the token type. The Value expression is up to you based on where you are sourcing the role information. Configure it to only be a claim with the requested scope. This is so if other applications exist, we do not send them information they do not care about:

Okta Add Claim with Roles view

Now we have a custom scope and claim configured under an authorization server. Configure Coder to use this:

# Grab this value from the Authorization Server > Settings > Issuer
# DO NOT USE the application issuer URL. Make sure to use the newly configured
# authorization server.
CODER_OIDC_ISSUER_URL=https://dev-12222860.okta.com/oauth2/default
# Add the new scope you just configured and offline_access for refresh tokens
CODER_OIDC_SCOPES=openid,profile,email,roles,offline_access
# Use the claim you just configured
CODER_OIDC_USER_ROLE_FIELD=roles
# See our docs for mapping okta roles to coder roles.
CODER_OIDC_USER_ROLE_MAPPING='{"admin-group":["template-admin","user-admin"]}'

Note

The offline_access scope is required in Coder v2.23.0+ to prevent hourly session timeouts.

You can use the "Token Preview" page to verify it has been correctly configured and verify the roles is in the payload.

Okta Token Preview

Troubleshooting

Users Are Logged Out Every Hour

Symptoms: Users experience session timeouts approximately every hour and must re-authenticate Cause: Missing offline_access scope in CODER_OIDC_SCOPES Solution:

  1. Add offline_access to your CODER_OIDC_SCOPES configuration
  2. Restart your Coder deployment
  3. All existing users must logout and login once to receive refresh tokens

Refresh Tokens Not Working After Configuration Change

Symptoms: Hourly timeouts, even after adding offline_access Cause: Existing user sessions don't have refresh tokens stored Solution: Users must logout and login again to get refresh tokens stored in the database

Verify Refresh Token Configuration

To confirm that refresh tokens are working correctly:

  1. Check that offline_access is included in your CODER_OIDC_SCOPES
  2. Verify users can stay logged in beyond Okta's access token lifetime (typically one hour)
  3. Monitor Coder logs for any OIDC refresh errors during token renewal