# CrushOIDC with Okta

This sets up sign-in through Okta on the login page, with [CrushOIDC](Plugin-CrushOIDC.md).

Okta can also be connected by SAML. For that, see [SAMLSSO](Plugin-SAMLSSO.md). Use one of the two; OpenID Connect is the simpler to set up.

## 1. Make the application in Okta

In the Okta admin console: **Applications** › **Applications** › **Create App Integration**.

| Field | Give |
|---|---|
| **Sign-in method** | **OIDC - OpenID Connect** |
| **Application type** | **Web Application** |
| **Grant type** | **Authorization Code** |
| **Sign-in redirect URIs** | the address of the server ending in `/SSO_OIDC/`: `https://files.example.com/SSO_OIDC/` |
| **Sign-out redirect URIs** | the address of the server: `https://files.example.com/` |
| **Assignments** | the people or groups who may use the server |

Okta shows the **Client ID** and the **Client secret**. Your Okta domain is the first part of the console's address, such as `example.okta.com`.

## 2. Set the plugin

| Setting | Value |
|---|---|
| **OpenID Configuration URL** | `https://` + your Okta domain + `/.well-known/openid-configuration`. Then **Fetch Configuration**. |
| **Client ID**, **Client Secret** | from Okta |
| **Scope** | `openid profile email`, and `groups` if you use the next step |
| **Claim as Username** | `email`, or `preferred_username` |
| **PKCE?**, **Verify ID Token?** | on |
| **Login button text** | "Sign in with Okta" |
| **End Session URL** | `{end_session_endpoint}?id_token_hint={id_token}&post_logout_redirect_uri=https%3A%2F%2Ffiles.example.com%2F` |

and the settings for [what the user gets](Plugin-CrushOIDC.md#what-the-user-gets).

## 3. Groups

Okta sends groups only when asked. In the application, on the tab **Sign On**, edit the **OpenID Connect ID Token** part:

| Field | Give |
|---|---|
| **Groups claim type** | **Filter** |
| **Groups claim filter** | the name of the claim, `groups`, and which groups to send: **Matches regex** `.*` for all, or a pattern for those that matter |

In the plugin, add `groups` to **Scope**, and use the claim in **OAuth Roles**:

```text
groups=FileTransfer : oidc_staff
groups=Partners : oidc_partners
```

## Things to know

- **Who may sign in is first of all Okta's decision.** Only people assigned to the application get through Okta at all. Roles on the server sort those who did.
- **Okta's own sign-in rules apply**: the second factor, the network, the device. The server asks for nothing more; tick **Skip OTP processing**.
- **A custom authorization server** of Okta has another configuration address, with `/oauth2/` and its name in it. Use the address of the server that issues the tokens for this application.

## Not tried for this page

Nothing was run against Okta: no account there was used. The steps on the provider's side follow the earlier documentation and the provider's console as it is known; names of menus change over time. The plugin's side is from its screen. Try the first setup with one test user, with **Debug** and **Log HTTP Request Calls** on.
