# Okta

> Configure a custom SAML 2.0 app integration in Okta.

Source: https://diakrin.com/docs/sso/okta

An Okta administrator connects Okta to Diakrin so your people sign in to the console with their Okta account. Use SAML for self-service setup. OIDC is available through your Diakrin onboarding contact.

## Before you start

| You supply | Example | Comes from |
| --- | --- | --- |
| Okta org URL | `https://acme.okta.com` | Your Okta Admin Console address, without `-admin` |
| Work-email domains | `acme.com` | The domains your people sign in with |
| Pilot users or group | `Diakrin pilot` | Your Okta directory |
| SAML SP Entity ID (SAML only) | `urn:amazon:cognito:sp:<poolId>` | The setup values on this page when signed in at app.diakrin.com/docs, or your Diakrin onboarding contact |

You need permission to create app integrations in Okta. Each person who signs in through Okta must already be a member of your Diakrin organization, with the same work email: [invite them](/docs/team#invite-a-colleague) and have them accept with their current sign-in before their first Okta sign-in. SSO proves who the person is; it never creates a membership. A person who joined in the last hour may be refused once; ask them to retry after an hour.

## Okta setup values

| Setting | Value |
| --- | --- |
| OIDC sign-in redirect URI | `https://auth.diakrin.com/oauth2/idpresponse` |
| OIDC issuer | `https://<tenant>.okta.com` (the Okta org authorization server) |
| OIDC scopes | `openid email` |
| SAML single sign-on URL (ACS) | `https://auth.diakrin.com/saml2/idpresponse` |
| SAML Audience URI (SP Entity ID) | `urn:amazon:cognito:sp:<poolId>` |

Copy the exact values from the setup values worksheet on this page when you read it signed in at app.diakrin.com/docs. Do not add a trailing slash.

## Connect with OIDC (recommended)

1. In Okta Admin Console, open **Applications → Applications → Create App Integration**.
2. Choose **OIDC - OpenID Connect** and **Web Application**, then **Next**.
3. Name the integration **Diakrin**. Under **Grant type**, keep **Authorization Code** only.
4. Set **Sign-in redirect URIs** to `https://auth.diakrin.com/oauth2/idpresponse`. Remove any other redirect URI and leave **Sign-out redirect URIs** empty.
5. Under **Assignments**, choose **Limit access to selected groups** and select your pilot group. Save.
6. On the **General** tab, keep **Client authentication** set to **Client secret**. Note the **Client ID**.
7. Send your Diakrin onboarding contact the issuer `https://<tenant>.okta.com`, the client ID and your work-email domains.

The issuer is your Okta org URL itself, not a custom authorization server such as `https://<tenant>.okta.com/oauth2/default`. Diakrin refuses any other issuer for the Okta preset. If you use an Okta custom domain, follow the generic OIDC values in [Connect your company SSO](/docs/sso#connect-with-oidc) instead.

Diakrin asks Okta for the scopes `openid email` only. It reads the `email` claim and the `sub` claim, which is the immutable Okta user id. It does not map any email-verification claim from Okta.

> [!WARNING]
> The client secret goes only to the Diakrin operator, through the secure channel your onboarding contact gives you. Never paste it into email, a chat, a ticket, a prompt or a file. Stop here until your onboarding contact confirms they received it.

## Connect with SAML

1. In Okta Admin Console, open **Applications → Applications → Create App Integration**.
2. Choose **SAML 2.0**, name the integration **Diakrin**, then **Next**.
3. Enter the values in the table below. Keep **Use this for Recipient URL and Destination URL** selected.
4. Under **Attribute Statements**, add one statement named `email`, name format **Unspecified**, value `user.email`. Add no other statement.
5. Finish, then assign your pilot users or pilot group on the **Assignments** tab.
6. On the **Sign On** tab, copy the **Metadata URL**. In **Settings → Sign-in → SSO identity provider**, paste the metadata URL or upload the XML, then select **Verify and connect**.

| Okta field | Value |
| --- | --- |
| Single sign-on URL | `https://auth.diakrin.com/saml2/idpresponse` |
| Audience URI (SP Entity ID) | `urn:amazon:cognito:sp:<poolId>` |
| Name ID format | Persistent |
| Application username | Custom: `user.getInternalProperty("id")` |
| Attribute statement `email` | `user.email` |

The application username becomes the SAML subject, so it must never change and never pass to another person. The Okta user id is both. A login or address can be reused for a new employee, which would let them sign in as the person who had it before, so do not use one as the application username.

## Prove your domain

Diakrin routes a work email to your Okta connection only after you prove you control its domain.

1. Add your domain in **Settings → Sign-in → Domains** to get a TXT value that starts with `diakrin-sso-proof=`. It is shown once.
2. Publish it as a TXT record at `_diakrin-sso.<domain>`, for example `_diakrin-sso.acme.com`. Subdomains such as `eu.acme.com` need their own record.
3. Select **Verify**. Keep the record in place: Diakrin checks it again every day, and a domain whose record is gone stops routing to your connection.

You can check the record yourself before selecting Verify:

```sh
dig +short TXT _diakrin-sso.acme.com
```

You should see one line with the `diakrin-sso-proof=` value you published.

## Activate and test

> [!WARNING]
> For SAML, check that **SSO identity provider** shows **Connected** and enable company SSO. For OIDC, confirm activation with your onboarding contact. A finished Okta integration alone does not sign anyone in.

1. Check that each pilot user is a member of your Diakrin organization. If not, [invite them](/docs/team#invite-a-colleague) and wait until they accept.
2. In a fresh browser session, open the console, choose **Sign in with company SSO**, enter a pilot user's work email and select **Continue with SSO**.
3. Okta opens. Complete sign-in. You should return to the Diakrin console in your organization.

Then run the full [pilot checklist](/docs/sso/testing).

## If it fails

| Symptom | Cause | Fix |
| --- | --- | --- |
| Okta shows an audience or destination mismatch | The ACS URL or Audience URI differs from the setup values | Compare them character by character, including trailing slashes |
| Okta says the user is not assigned | The person is not in the assigned group | Assign them to the Diakrin integration |
| The email goes to the normal sign-in, not Okta | The domain is not verified, its TXT record is gone, or the connection is not active yet | Check the record at `_diakrin-sso.<domain>` and ask your onboarding contact |
| Okta succeeds but Diakrin refuses the sign-in | The person is not yet a member of your organization, joined in the last hour, has a different email in Diakrin, or also belongs to another organization | Invite them and wait until they accept, retry after an hour, or ask your onboarding contact |
| A person who left can still start Okta sign-in | Removing them from Okta does not end a Diakrin session | Remove them from your organization in Diakrin as well; sign-in is refused once membership ends |
| The Okta preset is refused | The issuer is a custom authorization server or custom domain | Use `https://<tenant>.okta.com`, or the generic OIDC values |

Tell your onboarding contact before you rotate the SAML signing certificate or change the integration.

Official references: [Create OIDC app integrations](https://help.okta.com/en-us/content/topics/apps/apps_app_integration_wizard_oidc.htm), [Create SAML app integrations](https://help.okta.com/en-us/Content/Topics/Apps/apps_app_integration_wizard_saml.htm) and [SAML field reference](https://help.okta.com/en-us/content/topics/apps/aiw-saml-reference.htm).
