# Okta (https://www.dessn.com/docs/sso/okta)

Connect Okta to Dessn with an OIDC app integration (recommended) or a SAML app integration, field by field.

<Callout title="Not yet run on a live Okta org">
These steps follow Okta's current Admin Console and documentation. We haven't yet run them end to end on a live Okta org;
the same OIDC and SAML code has been run end to end with JumpCloud and Auth0. Tell us if any label differs.
</Callout>

You need to be an owner of your Dessn team, and an admin in Okta who can create app integrations. SSO is
rolling out to Enterprise teams, switched on per team by Dessn: see the [overview](https://www.dessn.com/docs/sso) for how it works and what
it checks. Okta's labels can differ slightly between versions of its Admin Console.

Choose one:

- **[OpenID Connect](#okta-with-openid-connect-recommended)** (recommended): the fewest fields, and nothing to update
  when Okta's signing keys rotate.
- **[SAML 2.0](#okta-with-saml-20)**: if your policy prefers SAML.

## Before you start: in Dessn
<Steps>
<Step>
### Verify your domain
Open [create.dessn.ai/w/settings/security](https://create.dessn.ai/w/settings/security). Under **Domains**, add your
email domain, add the TXT record Dessn shows at your DNS provider, then press **Verify**. See
[Verify your domain](https://www.dessn.com/docs/sso#verify-your-domain).
</Step>
<Step>
### Choose OIDC or SAML
Under **Identity provider**, choose **OIDC** or **SAML**. Dessn shows the values Okta asks for, with your connection key
filled in. Keep this tab open.
</Step>
</Steps>

## Okta with OpenID Connect (recommended)
<Steps>
<Step>
### Create the app integration
In the Okta Admin Console, open **Applications** and press **Create App Integration**. Choose:

| Field | Value |
| --- | --- |
| Sign-in method | **OIDC - OpenID Connect** |
| Application type | **Web Application** |

Press **Next**.
</Step>
<Step>
### Fill in the settings
| Field | Value |
| --- | --- |
| App integration name | `Dessn` |
| Grant type | Leave **Authorization Code** ticked. **Refresh Token** isn't needed |
| Sign-in redirect URIs | `https://create.dessn.ai/api/auth/sso/oidc/callback` |
| Sign-out redirect URIs | Remove the example: Dessn doesn't use it |
| Assignments | **Limit access to selected groups** (then pick them), or **Allow everyone in your organization to access** |

Press **Save**.
</Step>
<Step>
### Copy the client ID and secret
On the app's **General** tab, under **Client Credentials**, keep **Client authentication** on **Client secret**. Under
**Proof Key for Code Exchange (PKCE)**, tick **Require PKCE as additional verification**: Dessn always sends PKCE.
Copy the **Client ID** and the **Client secret**.
</Step>
<Step>
### Optional: the Okta dashboard tile
On the **General** tab, edit the **Login** settings:

| Field | Value |
| --- | --- |
| Login initiated by | **Either Okta or App** |
| Application visibility | Tick **Display application icon to users** |
| Login flow | **Redirect to app to initiate login (OIDC Compliant)** |
| Initiate login URI | `https://create.dessn.ai/api/auth/sso/oidc/initiate/<connection-key>`: copy **Initiate login URI** from Dessn |

Press **Save**.
</Step>
<Step>
### Assign people
On the app's **Assignments** tab, press **Assign**, then **Assign to People** or **Assign to Groups**, if you didn't
choose them in step 2.
</Step>
<Step>
### Connect it in Dessn
In Dessn's **Identity provider**, with **OIDC** chosen, enter:

| Field in Dessn | Value |
| --- | --- |
| Issuer URL | Your Okta org URL, for example `https://your-company.okta.com`, with no trailing slash: Okta's org issuer has none, unlike JumpCloud's and Auth0's, which end in `/`. If you use a custom authorization server, its issuer instead, for example `https://your-company.okta.com/oauth2/default` |
| Client ID | From step 3 |
| Client secret | From step 3 |
| New people join as | **Editor** or **Viewer** |

Press **Save**. Dessn reads Okta's discovery document and says so. The issuer must match the `issuer` in that document
exactly, so `https://your-company.okta.com/` (with a slash) is refused.
</Step>
<Step>
### Test, then turn it on
Under **Sign-in**, press **Test sign-in** and sign in through Okta as yourself. Then turn on **Single sign-on**.
Optionally, turn on **Require SSO** ([what it does](https://www.dessn.com/docs/sso#require-sso-and-the-break-glass-path)).
</Step>
</Steps>

## Okta with SAML 2.0
<Callout title="Rolling out after OpenID Connect">
SAML 2.0 is switched on after OpenID Connect. You can set your IdP up with the values below now; ask us when you want SAML
on for your team. If your IdP supports OpenID Connect, that is the quickest way in.
</Callout>


<Steps>
<Step>
### Create the app integration
In the Okta Admin Console, open **Applications** and press **Create App Integration**. Choose **SAML 2.0**, then press
**Next**. On **General Settings**, set **App name** to `Dessn` and press **Next**.
</Step>
<Step>
### Configure SAML
| Field | Value |
| --- | --- |
| Single sign-on URL | `https://create.dessn.ai/api/auth/sso/saml/acs/<connection-key>`: copy **ACS URL (Single sign-on URL)** from Dessn. Keep **Use this for Recipient URL and Destination URL** ticked |
| Audience URI (SP Entity ID) | `https://create.dessn.ai/api/auth/sso/saml/metadata/<connection-key>`: copy **SP Entity ID (Audience URI)** from Dessn |
| Default RelayState | Leave empty |
| Name ID format | **EmailAddress** |
| Application username | **Email** |

Press **Show Advanced Settings** and set:

| Field | Value |
| --- | --- |
| Response | **Signed** or **Unsigned**: either works |
| Assertion Signature | **Signed** (required) |
| Signature Algorithm | **RSA-SHA256** |
| Digest Algorithm | **SHA256** |
| Assertion Encryption | **Unencrypted** |

Under **Attribute Statements**, add (name format **Unspecified**):

| Name | Value |
| --- | --- |
| `email` | `user.email` |
| `firstName` | `user.firstName` |
| `lastName` | `user.lastName` |

Press **Next**.
</Step>
<Step>
### Finish
On the **Feedback** step, choose **I'm an Okta customer adding an internal app**, tick **This is an internal app that we
have created**, then press **Finish**.
</Step>
<Step>
### Copy Okta's metadata URL
On the app's **Sign On** tab, copy the **Metadata URL**.
</Step>
<Step>
### Assign people
On the app's **Assignments** tab, press **Assign**, then **Assign to People** or **Assign to Groups**.
</Step>
<Step>
### Connect it in Dessn
In Dessn's **Identity provider**, with **SAML** chosen, paste the URL into **Metadata URL**. Choose **New people join
as**: **Editor** or **Viewer**, then press **Save**. Dessn reads Okta's entity ID, sign-in URL and signing certificate
from the metadata.
</Step>
<Step>
### Test, then turn it on
Under **Sign-in**, press **Test sign-in** and sign in through Okta as yourself. Then turn on **Single sign-on**.
Optionally, turn on **Require SSO** ([what it does](https://www.dessn.com/docs/sso#require-sso-and-the-break-glass-path)).
</Step>
</Steps>

When Okta's SAML signing certificate is replaced, press **Save** on the connection in Dessn so it reads the new
metadata. Until then, Dessn refuses sign-ins signed with the new certificate. Dessn's Security settings show when the
current certificate expires.

## Troubleshooting
| If the Dessn login page says | Check this in Okta |
| --- | --- |
| **Your company's sign-in didn't let you in.** | The person isn't assigned to the app (**Assignments** tab). |
| **Your company's sign-in didn't share an email address with Dessn.** | SAML: set **Name ID format** to **EmailAddress** and **Application username** to **Email**, or add the `email` attribute statement. |
| **We couldn't confirm that sign-in with your company's identity provider.** | SAML: set **Assertion Signature** to **Signed** and **Signature Algorithm** to **RSA-SHA256**. Check the Single sign-on URL and Audience URI match Dessn's exactly. OIDC: check the client ID and secret, and that the issuer has no trailing slash. |
| **That address isn't on a domain this team has verified for single sign-on.** | The person's Okta email is on a domain your Dessn team hasn't verified. Verify that exact domain in Dessn. |
| **That sign-in took too long and expired.** | Start again: a sign-in attempt lasts 10 minutes. |
