> For the complete documentation index, see [llms.txt](https://docs.coherent.global/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coherent.global/identity-and-access-management/single-sign-on/okta-oidc.md).

# Okta (OIDC)

## Prerequisites

<details>

<summary>Permissions required for registering and configuring an app in Okta.</summary>

The Okta account must have permission to manage applications in Okta. Ideally the Okta account should be in the Super administrator role.

</details>

## Implement single sign-on (SSO)

It is recommended to use two separate browser tabs for the Keycloak (K) and Okta (O) portals to make it easier to apply the settings.

1. (K) Open a new tab in your browser and sign in to the target Spark tenant. Access the **Keycloak console** from the [Navigation menu](/navigation/navigation-menu.md#user-menu).
2. (K) Expand the **Add provider** dropdown and select **OpenID Connect v1.0**.
3. (K) Enter any name in the **Alias** field. The **Alias** should be a lowercase name without special symbols.
4. (K) Enter any name in the **Display Name** field. Please note this **Display Name** will appear in the button on the Spark sign-in page.
5. (K) Copy the **Redirect URI** value.
6. (O) In a second browser tab, sign in to Okta.
7. (O) In the left pane, expand *Applications* and select **Applications**.
8. (O) Select **Create App Integration**.
9. (O) For **Sign-in method** choose **OIDC - OpenID Connect** and for **Application type** choose **Web Application**. Select **Next**.
10. (O) Enter a name in the **App integration name** field.
11. (O) For **Grant type** select **Authorization Code**.
12. (O) In the **Sign-in redirect URIs** field, paste the modified redirect URI.
13. (O) For **Controlled access**, select **Allow everyone in your organization to access**. Check **Enable immediate access with Federation Broker Mode** then select **Save**.
14. (O) Copy the **Client ID** value.
15. (K) Return to Keycloak. In the **Client ID** field, paste the value copied in the previous step.
16. (O) Switch to Okta. Copy the **Client Secret.**
17. (K) Return to Keycloak. In the **Client Secret** field, paste the value copied in the previous step.
18. (O) Switch to Okta. Expand **Security** on the left pane and select on **API**.
19. (O) Select on the name of your authorization to bring up the settings page.
20. (O) Copy the **Metadata URI**.
21. (K) Return to Keycloak. In the **Discovery endpoint** field, paste the value copied in the previous step.
22. (K) Select **Add**.
23. (K) Expand **Advanced**.
24. (K) For the **Scopes** field, enter `openid email profile` and select **Save.**
25. (O) Okta Authorization Servers require an Access Policy to define which clients (applications) can request tokens under what conditions. If there is no default Access Policy that applies to all applications, then you must create one for your Okta OIDC app to ensure it can receive tokens.
    1. (O) In the left pane, expand ***Security***, then select **API**.
    2. (O) Select the **Authorization Servers** tab and select on the name of your Authorization Server.
    3. (O) Open the **Access Policies** tab.
    4. (O) Select **Add New Access Policy**.
    5. (O) Provide a name and description. In the **Assign** to section, select **The following clients**, enter the first three letters of your Okta OIDC app, select your app, and select **Create Policy**.
    6. (O) Select **Add Rule**.
    7. (O) Enter a name and uncheck *Client Credentials* and *Device Authorization*. Leave other settings as default unless your organization requires different values, then select **Create Rule**.
26. Navigate to your Spark tenant and sign in using the newly created provider. The Keycloak sign-in page shows a button with the display name you defined earlier.

## Configure Okta groups to Spark user groups

{% hint style="info" %}
Do not configure a mapper for the `user:pf` group. This is the default minimal Spark group that users must belong to in order to sign in to Spark. Configuring a mapper for this group unnecessarily duplicates sign-in permission management already controlled by your identity provider.
{% endhint %}

It is recommended to use two separate browser tabs for the Keycloak (K) and Okta (O) portals to make it easier to apply the settings. In this guide, we will set up the automatic roles for the `tenant-admin` role.

1. (O) In the first tab, sign in to Okta.
2. (O) Expand **Directory** and select on **Groups**.
3. (O) Create a group and prefix it with `spark` (or any preferred prefix), for example `spark-tenant-admin`.
4. (O) Add the test user to the group.
5. (O) On the left pane, expand **Security** and select **API**.
6. (O) Make sure **Authorization Servers** tab is selected and select the server name.
7. (O) Select Claims and then select **Add Claim**.
8. (O) Provide the following values then select **Create**.

   | Key                       | Value                  |
   | ------------------------- | ---------------------- |
   | **Name**                  | `groups`               |
   | **Include in token type** | `ID token and Always`  |
   | **Value Type**            | `Groups`               |
   | *Filter*                  | `Matches regex and .*` |
   | *Include in*              | `Any scopes`           |
9. (K) Open a new tab in your browser and sign in to the target Spark tenant. Access the **Keycloak console** from the [Navigation menu](/navigation/navigation-menu.md#user-menu).
10. (K) Select **Identity Providers** from the left pane and then the identity provider you configured in the previous section.
11. (K) Select the **Mappers** tab and then **Add mapper**.
12. (K) Provide the following values.

    | Name                   | Value                     |
    | ---------------------- | ------------------------- |
    | **Name**               | `tenant-admin`            |
    | **Sync mode override** | `force`                   |
    | **Mapper type**        | `Advanced Claim to Group` |
13. (K) Select **Add Claims**.
14. (K) Provide the following values:

    | Key      | Value          |
    | -------- | -------------- |
    | `groups` | `tenant-admin` |
15. (K) Leave **Regex Claim Values** as **Off** (which is the default).
16. (K) Select **Select Group**, choose `tenant-admin`, then select **Select**.
17. (K) Select **Save**.
18. Sign in to Coherent Spark with your test account. Select on your initials and hover over the groups icon to confirm your membership in `tenant-admin`.
19. We highly recommend creating at least a few additional app groups relevant for [Private tenant](https://docs.coherent.global/tenant-administration/private-tenant)s:
    * Group for `supervisor:pf` user accounts. In Spark, `supervisor:pf` members can manage permissions across all folders.
    * Groups for "standard" user accounts, e.g. `user:teamA`, `user:teamB`. These groups can be assigned to the users in your organization not responsible for tenant administration. Creating multiple roles for "standard" user accounts can be useful to separate access between teams.

## Create a bookmark application for Coherent Spark

See [Okta My Apps dashboard](/identity-and-access-management/single-sign-on/okta-my-apps-dashboard.md).
