# OAuth

## OAuth Application Setup Overview

The most common OAuth method is leveraging the OpenID Connect framework to achieve user authentication into your application. OIDC proves to be a flexible and secure means of authenticating your user base, with a multitude of different providers available. Form.io seamlessly manages this integration, offering multiple strategies and methods to authenticate users through OIDC providers.&#x20;

### Setting up an OIDC provider

Choosing an OIDC provider is the first step in the integration process. An OIDC application will then be created and configured. Remote Authentication will be configured for the  Application connected to the Form.io Project. This authentication method will validate the user using credentials stored with the OIDC provider, without relying on or accessing any underlying Form.io data, decoupling the OIDC user information from the Form.io project. Form.io offers integration with many providers, including the following:

* [**OneLogin**](#one-login)
* [**Okta**](#okta)
* [**Microsoft Entra ID** ](#microsoft-entra-id)
* [**Auth0**](#auth0)

{% embed url="<https://www.loom.com/share/ccd134fc26354ef79a18ac5e14a6138d?sid=502cc445-f624-4791-9116-62f176ffe1ff>" %}

The configuration process will vary for each OAuth/OIDC provider, however each provider generally requires the same setup. Each Provider will require the application domain to be saved to the [**Callback URL**](#user-content-fn-1)[^1]. This should be the domain the OIDC User is redirected to when they are authenticated from the OIDC Provider.&#x20;

### Creating / Assigning Users and Groups

Once the application is configured, establish a user base within the authentication provider. OIDC Users can then be assigned to OIDC Groups, which allows role mapping between the OIDC Group and Form.io Role.

### **Form.io Integration**

Each will produce comparable endpoints and credentials for integrating the provider into your Form.io project. Once the OIDC application has been configured, save the following information from your OIDC provider, which will be incorporated into the Authorization settings within your Project.&#x20;

{% hint style="info" %}
Access the application's **well-known endpoint** to retrieve the required endpoints for integration with the Form.io Project.&#x20;
{% endhint %}

<table data-header-hidden><thead><tr><th width="157"></th><th></th></tr></thead><tbody><tr><td><a data-footnote-ref href="#user-content-fn-2"><strong>Authorize URI</strong> </a></td><td><p>The endpoint where the  OIDC user is asked to authenticate, granting access to the client application</p><p>Example URL: <em>https://yourcompany.oidcprovider.com/auth</em></p></td></tr><tr><td><a data-footnote-ref href="#user-content-fn-3"><strong>Token URI</strong> </a></td><td>The endpoint utilized to retrieve the OAuth token from the provider after authorization has been granted.<br>Example URL: <em>https://yourcompany.oidcprovider.com/token</em></td></tr><tr><td><a data-footnote-ref href="#user-content-fn-4"><strong>User Info URI</strong></a></td><td>Examlpe URL The endpoint holding the scope of the authorizing user (or user attributes) such as email and ID stored within the OIDC provider<br>Examlpe URL: <em>https://yourcompany.oidcprovider.com/me</em></td></tr><tr><td><strong>Client ID</strong></td><td>Character string representing the client ID generated by the OAuth provider <br>Example ID: abc123def456</td></tr><tr><td><strong>Client Secret</strong></td><td>Character string representing the client ID generated by the OAuth provider <br>Example Secret: abc123def456</td></tr><tr><td><strong>Scope</strong></td><td>Communicates to the OIDC provider what information should be returned from the user to utilize for authentication. This data is compromised of various attributes and information about the User. <br>Ensure the required scopes <strong><code>openID</code></strong> and <strong><code>email</code></strong> are set within the Form.io project authentication. </td></tr></tbody></table>

Navigate to the Form.io Project's **Settings** > **Authentication > OAuth** and apply your OIDC settings to the appropriate Form.io setting fields within the **OpenID** tab.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FyI6uZ0sfTPFtoBjSDEPL%2Fintegrationsettings1.jpg?alt=media&#x26;token=0d1ad827-72ff-4d95-a3a7-ef5e33a3aecd" alt=""><figcaption></figcaption></figure>

#### **Configure Login Form**

The Form.io User Login form will then be modified along with an OAuth action, to support the OneLogin OIDC Authentication workflow.

#### Role Mapping

The OIDC Group associated with the OIDC user can be mapped to a Form.io role when the user authenticates. This is done by integrating the OIDC Provider group claim into the Form.io project and then mapping the OIDC Group name to a Form.io Role within the Oauth action saved to the Login Form.&#x20;

### General Troubleshooting

While the OAuth provider configuration and settings fall outside of Form.io, here are some common troubleshooting tips if your OIDC authentication isn't functioning correctly.

* #### How Do I Find The URI Endpoints?&#x20;

  The easiest way to identify the correct URI endpoints is to navigate to your OIDC URL and then append the '**well-known**' endpoint.&#x20;

  `/.well-known/openid-configuration`

  **Example:**

  <pre><code><strong>https://yourcompany.oidcprovider.com/.well-known/openid-configuration
  </strong></code></pre>

  The response will provide all necessary URI endpoints specific to your OIDC provider as well as any scopes or claims you may want to include within your Form.io Authorization settings or **O*****A*****uth Action**.&#x20;
* **Allow Origins** - The application domain that will authenticate the OIDC User. Ensure the correct client (application) domains are set within your OIDC provider utilized for authentication of the OIDC provider that will be allowed&#x20;
* **Callback URL** - The URL to which Auth0 redirects users after they authenticate from the Allow Origin domain. Typically would be the same URL(s) as the Allow Orgin endpoints. In some cases, the authentication domain may be different than the domain the user is redirected to after authentication. \
  Different Providers may refer to the Callback URL differently:\
  Redirection URI, Redirection URL, Redirect URI, Redirect URL, or Callback URI
* **Connection** - Connections determine how or where the OIDC user will authenticate. Many times, Username and Password credentials stored within the OIDC provider serve as the primary means of authenticating users. However, different providers offer integrations with other OAuth-enabled applications such as Google or Facebook for authentication. It's important to ensure that a connection method is enabled for your OIDC provider; some connections might be enabled by default, depending on the provider.&#x20;
* **Scope** - Check the supported Scope attributes (or claims) of your OIDC provider by searching 'scope' within the provider's 'well-known' endpoint. In every scenario,  `openid` and `email` will always be included in the scope of any OIDC provider and must be configured within the OpenID settings of your project.&#x20;
* **Authentication Method**- In most cases, the Authentication Method should be set to POST&#x20;
* **Application Type** - Ensure the correct application type is configured for the OIDC application. In many cases, this will be a 'Web Page' or 'Single Page Application'.

## One Login

This section covers the [**OneLogin Provider**](https://developers.onelogin.com/openid-connect) OIDC application setup process and integration with the Form.io Project.  Remote Authentication will be configured for the Application connected to the Form.io Project. This authentication method will validate the user using credentials stored with the OIDC provider, without relying on or accessing any underlying Form.io data, decoupling the OIDC user information from the Form.io project.

### Create and Configure Application

1. From your OneLogin Admin dashboard, create a new application by clicking the **Applications tab** and then the **Add App** button.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FuiZV51RNZqqmEhWgKmrB%2Foidcapplication.jpg?alt=media&#x26;token=07d17b3e-1830-4fa8-a3ff-553f7320fa4f" alt=""><figcaption></figcaption></figure>

2. Select the **OpenId Connect (OIDC)** application

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FvsJVvI7BEc7FDr3PvD0G%2Fopenidconnection.jpg?alt=media&#x26;token=c2161e17-40b6-40d3-aaf1-52e1273d4ee2" alt=""><figcaption></figcaption></figure>

3. Give the Application a name and click the **Save** button with the default configurations

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FRTjwINbHpTsVCNttW7JH%2Fsaveapplication.jpg?alt=media&#x26;token=30d4f331-3306-477c-aea3-e9f5d60790c7" alt=""><figcaption></figcaption></figure>

4. Click the **Configuration** tab to set up the application details
   * Add the **Redirect URIs** - Live endpoint of the hosted application where the response to the SAML request should be sent, after the user signs in\
     `https://app.yoursite.com`
   * Add the **Post Logout Redirect URIs** - Live endpoint that redirects a user to a specified URL after the logout process is complete\
     `https://app.yoursite.com`

The configuration should look similar to the following:

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FDCivMueTo4Klnu5VjJ3I%2Fsamlconfiguration.jpg?alt=media&#x26;token=2ca27544-0fdb-4216-b902-e0da2ed4269e" alt="" width="563"><figcaption></figcaption></figure>

5. Click the **SSO** tab and set the **Authentication Method** to **POST**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FGzxqKLM0WOqhT8lF3tva%2Ftokenendpoint.jpg?alt=media&#x26;token=61f25774-48b2-4da5-b53b-bbac1e1e3c5a" alt="" width="380"><figcaption></figcaption></figure>

Adding a Group Parameter will enable the ability to include the user role (group) in the OIDC claim.

6. Click the **Parameter** tab
7. Click the existing **Group** parameter
8. Set the **value** to **User Roles** and the **Transform** to **Semicolon Delimited input**
9. Set the field name to **Groups**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FWddAXvuoZ80uIE1ecMiN%2Fgroups.jpg?alt=media&#x26;token=3ab15877-bb78-425d-8305-e44510c7dfac" alt="" width="531"><figcaption></figcaption></figure>

### Create User

With the application configured, create a user base within the OneLogin Admin dashboard. Users can then be assigned to a Role linked with the OIDC Application, allowing OIDC and Form.io role mapping.

1. Within the OneLogin Admin dashboard, hover over the User tab and click **Users**
2. Click the **New User** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fnj5qN3egaNR6rRAMYO0J%2Fcreateuser.jpg?alt=media&#x26;token=fbaa610a-72af-4414-84cf-7ec66e94526a" alt=""><figcaption></figcaption></figure>

3. Input the Information for the User and then click **Save User**
4. If you would like to set a password, click the **More Action** tab and **Change** **Password**
5. Generate **multiple** **users** to assign them to different roles further in the walkthrough

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FgdPzYCArQpTIlQ7i1DFQ%2Fuserinformation.jpg?alt=media&#x26;token=bf19dd58-bca5-4568-9e90-7851086e42eb" alt=""><figcaption></figcaption></figure>

### Create and Assign Groups

With our Users in place, the next step is to create **Roles** the OIDC Users will be assigned to. This will allow us to establish mappings between OIDC roles and Form.io roles.

1. Within the OneLogin Admin dashboard, hover over the User tab and click **Roles**
2. Click the **New Role** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FX0Nx96C1pktSUsK8KNKf%2Froles.jpg?alt=media&#x26;token=105153ce-b4a2-413b-a82e-955d8171a88a" alt=""><figcaption></figcaption></figure>

3. Give the **Role** a name and **select** the OIDC Application the Role should be associated with
4. Click the **Save** role

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FcUczmbZRtxKuM3wCfLnz%2Fassignrole.jpg?alt=media&#x26;token=394949d2-832f-44af-a062-962463353242" alt=""><figcaption></figcaption></figure>

5. Within the **Roles** tab, click the **Role** that was just created and click the **Users** Tab
6. Using the search bar, search and select all Users that should be added to the Role and click **Check**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FSVmwfETq6ZTzwIcmo660%2Faddusertoapp.jpg?alt=media&#x26;token=34369afa-bc1f-46cb-a5c3-024851eab958" alt=""><figcaption></figcaption></figure>

5. Click the **Add To Role** button for each user
6. Click **Save**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FGEUSIrO9rkxfgkGgKbjK%2Faddusers.jpg?alt=media&#x26;token=b815f7a6-1297-4116-ae80-2ab1ca02e09d" alt=""><figcaption></figcaption></figure>

#### **Assign Role To OneLogin Application**

With the Roles established, the next step is to assign the Role to the OIDC application

1. Hover over the **Application** tab and select Applications
2. Navigate to your **OIDC Application**
3. Click the **Access** tab
4. **Select** all of the **Roles** you wish to assign to the Application. Users assigned to the selected roles will be added to the Application.
5. Click **Save**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fjl72ZaIp0ktbD13KbztT%2Fassignrolestoapp.jpg?alt=media&#x26;token=c8ec82fa-3265-4bbf-919f-a65e38952121" alt=""><figcaption></figcaption></figure>

### **Form.io Integration**

After the OIDC application is properly configured, information from the provider will be utilized to integrate with the Form.io project and establish remote authentication. Navigate to the Form.io Project settings and apply the OIDC settings to the appropriate Form.io field settings.

#### **Client ID and Secret Key**

1. Within your OIDC Application, click the **SSO** tab
2. Copy the **Client ID**&#x20;
3. Click the **Show client secret** button and **copy** the secret

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FIrPCxIjtlqn4UJEtKVkD%2Fclientsecret.jpg?alt=media&#x26;token=a0ae5282-c7b0-4794-aae5-13c08bf10c7d" alt=""><figcaption></figcaption></figure>

4. Navigate to the OAuth settings within your Form.io project\
   **Settings** > **Authentication > OAuth**

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FywaOATjkZv158Riq7BYt%2Foauth1.png?alt=media\&token=f3c262b3-7f1e-4f81-82bd-85336f96815e)

5. Paste the OIDC **Client ID** and **Client Secret** to the correlated Form.io field settings

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FiwogjctkkWYlhDy4wpNp%2Fclientidsecret.jpg?alt=media&#x26;token=1c8b59e0-2165-4cee-870b-ff3acaa1ef24" alt="" width="563"><figcaption></figcaption></figure>

#### Well-Known Configuration

1. Click the **SSO** tab within the **OIDC** application
2. Click the **Well-known Configuration** button to access the OIDC application metadata

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fj7Of5ZnA90PkBZw5IIwq%2Fwellknownconfig.jpg?alt=media&#x26;token=74a36712-aeca-4709-8052-ad2f49a81681" alt="" width="563"><figcaption></figcaption></figure>

The well-known configuration will look something like this:

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fl2WIrX2OTM8T8r95amRu%2Fopenidconfig.jpg?alt=media&#x26;token=6900ddea-a68b-42ff-a0dd-1719958d7512" alt="" width="563"><figcaption></figcaption></figure>

3. Search the well-known configuration JSON file and find the following **endpoints**, then map them to the **corresponding** **fields** in your Form.io settings.

| Form.io Setting        | Well-known Configuration |
| ---------------------- | ------------------------ |
| Authorize URI          | authorization\_endpoint  |
| Token URI              | token\_endpoint          |
| Logout URI             | end\_session\_endpoint   |
| User Info (claims) URI | userinfo\_endpoint       |

4. Input the following values within the **Scope** setting\
   **openid**  | **email**

{% hint style="info" %}
The `openid` and `email` scopes are **required** for all OIDC providers and must be configured in your project's OpenID settings to ensure successfully user authentication
{% endhint %}

Your settings should look something like this

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FSbA1dHE9oGHviDwzsjxU%2Foidc.jpg?alt=media&#x26;token=fc9e63a5-87cd-4db6-b870-db44bf62d842" alt="" width="563"><figcaption></figcaption></figure>

#### **Configure Login Form**

Configure the Form.io User Login form to support the OneLogin OIDC Authentication within the application.

1. Navigate to the Form.io project and **edit** the application **Login** form.
2. Add a **Button** component&#x20;
3. Within the Button settings, set the **Action** to **OAuth** and **OAuth** **Provider** to **OpenID**
4. **Save** the form

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FbAestRXf9XdCDKanuKHt%2Fbutton.jpg?alt=media&#x26;token=6e96b3c2-a7e5-47b6-97d1-c387f6367d45" alt=""><figcaption></figcaption></figure>

#### **Oauth Action**

Once the Login form has been configured, an OAuth action will be added to the form to facilitate the  OIDC authentication process.

1. Navigate to the **Login** form within the Form.io Project
2. Click the **Action** tab and add the **OAuth** action
3. Click the **OAuth Provider** setting and select **OpenID**
4. Click the **Action** setting and select **Remote Authentication**
5. Click the **Sign-in with OAuth Button** setting and select the **SSO** button&#x20;
6. If you are mapping roles, add the following setting to the **Assign Roles** setting fields

   * The **Claim** setting will be the claim name that supports roles within the OIDC scope.&#x20;
   * The **Value** setting will be the identifier for the OIDC Group.&#x20;
   * The **Role** setting is the Form.io role that should be assigned to users with the given OIDC Role.<br>

   In the example below OIDC users with the **Member** role will authenticate into the application with the Form.io **Authenticated** role. OIDC users with the **Admin** role will authenticate into the application with the Form.io **Administrator** role.

| Claim (OIDC) | Value (OIDC) | Role (Form.io) |
| ------------ | ------------ | -------------- |
| groups       | Member       | Authenticated  |
| groups       | Admin        | Administrator  |

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fb85mMVsKDnU2tTKhIqOZ%2Foauthaction.jpg?alt=media&#x26;token=713681be-1550-43ad-b20e-5d1b7c694707" alt=""><figcaption></figcaption></figure>

#### Role Mapping

In many cases, you may want to map the OIDC Role associated with the OIDC User to a Form.io Role. This can be done by adding the OIDC group claim within the scope setting of the Form.io Project as well as the Oauth action.

1. Navigate to the **Form.io Authorization** setting\
   **Settings** > **Authentication > OAuth**
2. Add the following values to the **Scope** setting field\
   **groups**&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FbkrjaRBFIslRSqQ3KoJA%2Fscope2.jpg?alt=media&#x26;token=7db4492e-3296-4aa6-bf4a-57998d1872dd" alt="" width="425"><figcaption></figcaption></figure>

3. Within the OneLogin **OIDC Application,** click the **Access** tab and take note of the **Role** **Names** assigned to the application.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FJj9hlYcVniGQRXFatO6S%2Fimage.avif?alt=media&#x26;token=a746461d-e22e-4195-ae18-7850ea99d91f" alt="" width="563"><figcaption></figcaption></figure>

4. Navigate to the **Role** settings and map the **OIDC** **group** (case sensitive) to the desired **Form.io Role**\
   The example below maps OIDC users with the Member role to the Form.io Authenticated role and OIDC users with the Admin role to the Form.io Administrator role

| Claim (OIDC) | Value (OIDC) | Role (Form.io) |
| :----------: | :----------: | :------------: |
|    groups    |    Member    |  Authenticated |
|    groups    |     Admin    |  Administrator |

5. **Save** the **settings**

### Testing Authentication

Test the authentication workflow to ensure it functions correctly. &#x20;

1. Navigate to your Applications authentication page and click the **SSO with OIDC** button.&#x20;
2. Enter the **OIDC** **credentials** into the OneLogin authentication page

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FQSLghOkQPBOqsBeEsxyD%2Foneloginauth.jpg?alt=media&#x26;token=5793048a-1206-4530-9b49-d2f0ba80aa09" alt="" width="344"><figcaption></figcaption></figure>

3. Once authenticated, the OIDC user should carry the **OIDC** **Group** **Role** (Member) as well as the mapped **Form.io Role ID** within the metadata of the user object.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fq26F4gKIxBNvmKkGtxeC%2Fusermetadata.jpg?alt=media&#x26;token=c62ad38b-55f0-4655-a204-f6c1e91641c9" alt="" width="563"><figcaption></figcaption></figure>

## Okta

This section covers the [**Okta OIDC**](https://www.okta.com/openid-connect/) application setup process and integration with the Form.io Project. Remote Authentication will be configured for the  Application connected to the Form.io Project. This authentication method will validate the user using credentials stored with the OIDC provider, without relying on or accessing any underlying Form.io data, decoupling the OIDC user information from the Form.io project

### Create and Configure Application

1. From your [**Okta Developer**](https://developer.okta.com/) dashboard, create a new application by clicking the **Applications tab** and then the **Applications** button.
2. Click the **Create App Integration** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fk0L9K65BjDeI4l9uOk9Y%2Foktacreate.jpg?alt=media&#x26;token=91398cc8-2aa6-4af5-818e-69b52d99626c" alt=""><figcaption></figcaption></figure>

3. Select **OIDC - OpenID Connect** from the **Sign-in method** section
4. Select **Web Application** from the **Application type** section

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FMALIe670w5AvpbwYkHZX%2FCreateApplication.jpg?alt=media&#x26;token=a0bbb863-2ecc-424f-92cd-b758d16725f4" alt=""><figcaption></figcaption></figure>

5. Apply the following configurations to the **General Settings** of the Okta OIDC Application
   * Add the **Sign-in Redirect URI** - Domain of the hosted application where Okta sends the authentication response and ID token for the sign-in\
     `https://app.yoursite.com/yourloginpage`
   * Add the **Sign-out redirect URIs** - Live endpoint that redirects a user to a specified URL after the logout process is complete\
     `https://app.yoursite.com`

The configuration should look similar to the following:

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FCy84lov7cVpCQVmx17tP%2Fredirects.jpg?alt=media&#x26;token=5cd4153b-057c-469c-ba61-bc994afbefa1" alt=""><figcaption></figcaption></figure>

5. Select a **Controlled Access** setting
6. **Save** the Settings to create the application

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FJJPxWI4dPQnq6idnWnEP%2Fgroupassignment.jpg?alt=media&#x26;token=8384e37b-ba81-477e-9dba-73e9e5f27cd5" alt="" width="563"><figcaption></figcaption></figure>

### Create User

Once the application is configured, establish a user base in the Okta dashboard. Users can be assigned to Okta Groups, which can then be mapped to roles in Form.io.

1. Within your Okta Admin dashboard, click the **Directory** tab and select **People**
2. Click the **Add person** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fq9VMucYBPFvJMYBZeHhs%2Fpeopledashboard.jpg?alt=media&#x26;token=4e11a772-9158-4e30-84a0-a017c93c7c48" alt=""><figcaption></figcaption></figure>

3. Enter person **details** for the OIDC User
4. Click the **Password** dropdown to determine how Users password will be set
5. Click **Save** to add the User

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FjuTXWJr3mveyFwr7oDcN%2Faddperson.jpg?alt=media&#x26;token=1cfbf2ce-24b8-49b1-994b-617d78811309" alt="" width="563"><figcaption></figcaption></figure>

### Create and Assign Groups

With Users in place, create **Groups** the OIDC Users will be assigned to. This will allow us to establish mappings between OIDC roles and Form.io roles.

1. Within your Okta Admin dashboard, click the **Directory** tab and select **Groups**
2. Click the **Add Group** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FbQKIoQETK2hhMV5vVNZM%2Fgrouptab.jpg?alt=media&#x26;token=0997b510-71c5-4801-be2f-15eccd26be07" alt=""><figcaption></figcaption></figure>

3. Give your Group a **Name** and click **Save**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fg5M0z1qhhnBCTux4JfWs%2Faddgroup.jpg?alt=media&#x26;token=0707a8f7-09d1-4b6f-9310-8bc64d6f0098" alt=""><figcaption></figcaption></figure>

With a Group created, the next step is to assign users to the Group.

4. From the **Group** tab, select the Group to add Users to
5. Click the **Assign people** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FBlvreHWNucGKajdddWqh%2Fgrouptab2.jpg?alt=media&#x26;token=e640a5df-1c7f-448b-b01d-64dfb50971a2" alt=""><figcaption></figcaption></figure>

5. Assign a User to a Group by clicking the **+** button next to their username.&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FGpGJYxO11qUukRmrXbcB%2Fassignuser.jpg?alt=media&#x26;token=824fd85e-87e0-4c90-aa4c-0889d871c52d" alt=""><figcaption></figcaption></figure>

6. Within your Okta application, click the **Sign-On** tab
7. Click **Edit** under the **OpenID Connect ID Token** section

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FDJ3mFL1Lge5Y4YjQKcIx%2Fokta.png?alt=media&#x26;token=0eaa92a4-9106-4fb7-844a-6c0f13d516e8" alt="" width="563"><figcaption></figcaption></figure>

8. &#x20;Set the **Groups claim type** to **filter**&#x20;
9. Input **groups** into the Groups claim filter&#x20;
10. Set  the filter type to **Matches regex**&#x20;
11. Add a "**\***" character next to the filter type
12. **Save** the settings

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FUvdbtlLT7uTSzjIc0t5o%2Foktagroups.png?alt=media&#x26;token=3781cf80-fb73-400b-8297-f464ab56f927" alt="" width="563"><figcaption></figcaption></figure>

#### **Assign Groups To Okta Application**

After establishing the Groups, the next step is to assign them to the OIDC application

1. To assign the Group, open the **Directory** tab, select the **Group,** and click the **Applications** tab
2. Click the **Assign applications** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FS2uXjVmLiLFgl0Go8STi%2Fassigngroup.jpg?alt=media&#x26;token=15a25627-ad2e-420f-92d7-0cb8638e565d" alt="" width="563"><figcaption></figcaption></figure>

3. Within the modal window, click the **Assign** button next to the **OIDC application**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FKADGSshOhJ4LZRIOvWTH%2Fassignapp.jpg?alt=media&#x26;token=19099650-04b5-4d65-a493-62c93b7e10b0" alt="" width="504"><figcaption></figcaption></figure>

### **Form.io Integration**

After the OIDC application is properly configured, information from the provider will be utilized to integrate with the Form.io project and establish remote authentication. Navigate to the Form.io Project settings and apply the OIDC settings to the appropriate Form.io field settings.

#### **Client ID and Secret Key**

1. Within your **Okta** Application, click the **General** tab
2. Copy the **Client ID** and **Client Secret**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FDDa9HdLct91xvmbWqXVi%2Fidsecret.jpg?alt=media&#x26;token=a6c7da84-3621-42be-ab0f-5b8d5ae0eef4" alt="" width="563"><figcaption></figcaption></figure>

4. Navigate to the OAuth settings within your Form.io project\
   **Settings** > **Authentication > OAuth**

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FywaOATjkZv158Riq7BYt%2Foauth1.png?alt=media\&token=f3c262b3-7f1e-4f81-82bd-85336f96815e)

5. Paste the OIDC **Client ID** and **Client Secret** to the correlated Form.io field settings

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FiwogjctkkWYlhDy4wpNp%2Fclientidsecret.jpg?alt=media&#x26;token=1c8b59e0-2165-4cee-870b-ff3acaa1ef24" alt="" width="563"><figcaption></figcaption></figure>

#### Well-Known Configuration

1. Append the well-known endpoint to the Okta application URL&#x20;

`https://dev-myapplication-admin.okta.com/.well-known/openid-configuration`

2. Open the **URL** within the **browser**.

The well-known configuration will look something like this:

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FBsJc6pQRYkTjy1ilxzow%2Fwellknown.jpg?alt=media&#x26;token=3d464a48-7168-4ad5-b743-7bef10c57ac9" alt=""><figcaption></figcaption></figure>

3. Search the well-known configuration JSON file and find the following **endpoints**, then map them to the **corresponding** **fields** in your Form.io settings.

   | Form.io Setting        | Well-known Configuration |
   | ---------------------- | ------------------------ |
   | Authorize URI          | authorization\_endpoint  |
   | Token URI              | token\_endpoint          |
   | User Info (claims) URI | userinfo\_endpoint       |

   4. Input the following values within the **Scope** setting\
      **openid**  | **email**

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>The <code>openid</code> and <code>email</code> scopes are <strong>required</strong> for all OIDC providers and must be configured in your project's OpenID settings to ensure  user authentication</p></div>

   \
   Your settings should look something like this

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FkZtqefbsL4P4CFTf6Nyp%2Foktasettings.jpg?alt=media&#x26;token=a2659bbc-59cb-4fef-b076-af5ac667ad68" alt="" width="550"><figcaption></figcaption></figure>

#### **Configure Login Form**

Configure the Form.io User Login form to support the OneLogin OIDC Authentication within the application.

1. Navigate to the Form.io project and **edit** the application **Login** form.
2. Add a **Button** component&#x20;
3. Within the Button settings, set the **Action** to **OAuth** and **OAuth** **Provider** to **OpenID**
4. **Save** the form

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FbAestRXf9XdCDKanuKHt%2Fbutton.jpg?alt=media&#x26;token=6e96b3c2-a7e5-47b6-97d1-c387f6367d45" alt=""><figcaption></figcaption></figure>

#### **Oauth Action**

Once the Login form has been configured, an OAuth action will be added to the form to facilitate the  OIDC authentication process.

1. Navigate to the **Login** form within the Form.io Project
2. Click the **Action** tab and add the **OAuth** action
3. Click the **OAuth Provider** setting and select **OpenID**
4. Click the **Action** setting and select **Remote Authentication**
5. Click the **Sign-in with OAuth Button** setting and select the **SSO** button&#x20;
6. If you are mapping roles, add the following setting to the **Assign Roles** setting fields

   * The **Claim** setting will be the claim name that supports roles within the OIDC scope.&#x20;
   * The **Value** setting will be the identifier for the OIDC Group.&#x20;
   * The **Role** setting is the Form.io role that should be assigned to users with the given OIDC Role.<br>

   In the example below OIDC users with the **Member** role will authenticate into the application with the Form.io **Authenticated** role. OIDC users with the **Admin** role will authenticate into the application with the Form.io **Administrator** role.

| Claim (OIDC) | Value (OIDC) | Role (Form.io) |
| ------------ | ------------ | -------------- |
| groups       | Member       | Authenticated  |
| groups       | Admin        | Administrator  |

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F775giuHYcxBtOgci3BXO%2Foauthaction.jpg?alt=media&#x26;token=fd3477bd-6e8f-4171-9c46-ace8b1179f80" alt=""><figcaption></figcaption></figure>

#### Role Mapping

In many cases, you may want to map the OIDC Role associated with the OIDC User to a Form.io Role. This can be done by adding the OIDC group claim within the scope setting of the Form.io Project as well as the Oauth action.

1. Navigate to the **Form.io Authorization** setting\
   **Settings** > **Authentication > OAuth**
2. Add the following values to the **Scope** setting field\
   **groups**&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FbkrjaRBFIslRSqQ3KoJA%2Fscope2.jpg?alt=media&#x26;token=7db4492e-3296-4aa6-bf4a-57998d1872dd" alt="" width="425"><figcaption></figcaption></figure>

3. Within the OneLogin **OIDC Application,** click the **Access** tab and take note of the **Role** **Names** assigned to the application.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FGpwKKMDotLZ5bMxLS9iA%2Foktagroups.jpg?alt=media&#x26;token=7dd23ea0-cc5a-4c61-8240-322764f98812" alt=""><figcaption></figcaption></figure>

4. Navigate to the **Role** settings and map the **OIDC** **group** (case sensitive) to the desired **Form.io Role**\
   The example below maps OIDC users with the Member role to the Form.io Authenticated role and OIDC users with the Admin role to the Form.io Administrator role

| Claim (OIDC) | Value (OIDC) | Role (Form.io) |
| :----------: | :----------: | :------------: |
|    groups    |    Member    |  Authenticated |
|    groups    |     Admin    |  Administrator |

6. **Save** the **settings**

### Testing Authentication

Test the authentication workflow to ensure it functions correctly. &#x20;

1. Navigate to your Applications authentication page and click the **SSO with OIDC** button.&#x20;
2. Enter the **OIDC** **credentials** into the Okta authentication page

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fs0C9CZwI2AzZKqE2lKvO%2Foktasignin.jpg?alt=media&#x26;token=9562573f-d52d-4b6b-a104-ec5ef96709bb" alt="" width="302"><figcaption></figcaption></figure>

3. Once authenticated, the OIDC user should carry the **OIDC** **Group** **Role** (Member) as well as the mapped **Form.io Role ID** within the metadata of the user object.

## Microsoft Entra ID

This section covers the [**Microsoft** **Entra ID**](https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id) OIDC application setup process and integration with the Form.io Project. Remote Authentication will be configured for the  Application connected to the Form.io Project. This authentication method will validate the user using credentials stored with the OIDC provider, without relying on or accessing any underlying Form.io data, decoupling the OIDC user information from the Form.io project

### Create and Configure Application

1. Navigate to the [**Azure Portal**](https://portal.azure.com/), click the left navigation panel, and select **Microsoft Entra ID**.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FRYf2NWUBHuLbQnlhNRaV%2Fmicrosoftentra.jpg?alt=media&#x26;token=16e210b9-a97b-4f8b-a5b7-c6c6da169024" alt=""><figcaption></figcaption></figure>

2. Click the **left-hand navigation bar** and select **App registrations**
3. Click the **+New registration** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fi8hqKhf1drr6N2g4JqLw%2Fappregistrations.jpg?alt=media&#x26;token=89a02bd9-f518-4a91-886e-aeb70e04f39a" alt=""><figcaption></figcaption></figure>

4. Give the application a **name**
5. Under the **Redirect URI** section, select **Web** from the dropdown, and input the application **URI**
6. Click the **Register** button

The configuration should look similar to the following:

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FfUA8LUXiVjZ2ZYDUSoc4%2Freigsterapplication.jpg?alt=media&#x26;token=78c2a0a7-e777-4adc-8d01-fd7425ef642b" alt=""><figcaption></figcaption></figure>

#### Creating Client Secret

Once the application has been created, a Client secret will need to be generated that will be added to the  Authentication OAuth integration settings within the Form.io Project.

1. Click the **Certificates and secrets** tab
2. Click the **+ New client secret** button&#x20;
3. Give the secret a **Description**&#x20;
4. Click the **Add** button&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F32hfKVUEXKBBLYXpdfUM%2Fclientsecret.jpg?alt=media&#x26;token=baddb413-3b5e-46cb-9716-4cb84af1b5f2" alt=""><figcaption></figcaption></figure>

5. Copy the **Client Secret Value**

{% hint style="warning" %}
This is the only opportunity to save the  **Client Secret Value**
{% endhint %}

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F9f67PG91KzGk70GOX1zs%2Fsecretvalue.jpg?alt=media&#x26;token=9c78f6b1-66be-416e-9ab3-832aa0d1b14a" alt=""><figcaption></figcaption></figure>

#### Adding group claim

1. Click on **Token Configuration**
2. Click **Add groups claim**
3. Check the **Groups assinged to the application** setting&#x20;
4. Click **Add**

<div data-full-width="true"><figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FM2bIS6BuXTFmtFxdpZ8d%2Fentraidgroup.jpg?alt=media&#x26;token=80285862-f3f1-4716-95ac-f02135a8dbf3" alt="" width="563"><figcaption></figcaption></figure></div>

### Create User

Once the application is configured, establish a user base within the Entra ID dashboard. Users can be assigned to Entra ID Groups, which can then be mapped to roles in Form.io.

1. Within the **Entra ID** application, click \
   **Home** > **Microsoft Entra ID** > **Users**
2. Within the **All Users** tab click the **+New user** button&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F8NuKbgy0Sl6FNM2PZLJK%2Fcreateuser.jpg?alt=media&#x26;token=eabccae3-1f63-4797-b190-cae543f404a7" alt=""><figcaption></figcaption></figure>

3. Input the User information and click the **Review + create** button

{% hint style="warning" %}
Ensure the User **email address** and **name** is set within the **Properties** tab of the user profile

Contact your Azure administrator to add the required properties to the user profile
{% endhint %}

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fp4pH8LWkYigKRS3QSlO9%2Freviewuser.jpg?alt=media&#x26;token=c247193c-054c-4704-94df-a0782522eb58" alt="" width="475"><figcaption></figcaption></figure>

4. Create several other users to test Group and Role mapping detailed in the next section.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F22wHerxjXqELl9u8Hh3o%2Fusers.png?alt=media&#x26;token=cb9006f8-1cc2-4ee8-9725-ea74d4093a5a" alt=""><figcaption></figcaption></figure>

### Create and Assign Groups

With Users in place, the next step is to create **Groups** the Entra ID Users will be assigned to. This will allow us to establish mappings between EntraID groups and Form.io roles.

1. Within the Azure  dashboard, click the left-hand navigation bar, **Groups**, and **All Groups** tab
2. Click the **New group** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FrybdaroA5mzJxtbNCH56%2Fnewgroup.jpg?alt=media&#x26;token=8162c97f-e4a2-44f9-ad09-f0588d682212" alt=""><figcaption></figcaption></figure>

3. Give the Group a **Group Name** and keep the remaining settings at their default values

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fk4zFnuchRIYb301oe1M3%2Fnewgroup.png?alt=media&#x26;token=cb2415b7-0d1d-42f2-b0e3-04cde0156993" alt="" width="563"><figcaption></figcaption></figure>

4. Click the **No Members Selected** button to assign users
   * **Search** for the User created in the previous section
   * **Select** the User
   * Click the **Select** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fan9oQMVIBwcdOKcFEko5%2FAdd%20members%20-%20Microsoft%20Azure%202024-09-11%2011-47-05.jpg?alt=media&#x26;token=95231599-c3a0-432e-b84e-d80ebcacc4b8" alt=""><figcaption></figcaption></figure>

5. Click the **Create** button
6. Follow the same steps to create additional **Groups**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FMVuYJWgo5b4tf6ypk89d%2Fgroups.jpg?alt=media&#x26;token=13f8c502-634a-4a19-961b-5f443d0c53f3" alt=""><figcaption></figcaption></figure>

#### **Assigning Groups to Application**

With the Groups established, the next step is to assign the Groups to the Entra ID application.

{% hint style="warning" %}
Groups mappings for Entra ID are supported for formio-server version 9.6.x and above
{% endhint %}

{% hint style="warning" %}
A proper license is required to add Groups to your Entra ID application
{% endhint %}

1. Navigate back to your **Entra ID OIDC** application
2. Select the **Users and groups** tab then click the **+ Add user/group** button
3. On the next screen, click the **None Selected**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FibZI2PGbjDutTMC9oxxu%2Faddusergroups.jpg?alt=media&#x26;token=e7a62977-1bc5-4775-adf0-f93e8ffd4c03" alt=""><figcaption></figcaption></figure>

4. Select the **Groups** to add to the application
5. Click the **Select** button at the bottom of the screen and then **Assign** on the following page

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FKRw53S5mtqIRGmwlXwQE%2Fselectgroups.jpg?alt=media&#x26;token=f449ad43-909b-4e12-88d6-f11f943164a0" alt=""><figcaption></figcaption></figure>

After assigning the Groups, you should see the Groups displayed within the User and Groups tab of the Entra ID application. Users assigned to the selected groups will be associated with the Entra ID Application.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FtiQP7WKiTyS85vHR2w83%2Fgroupoverview.jpg?alt=media&#x26;token=122a16d1-e8c5-46ca-9b58-08d01510576d" alt=""><figcaption></figcaption></figure>

### **Form.io Integration**

Once the OIDC application is properly configured, information from the application will be used to integrate the application with the Form.io project. Navigate to the Form.io Project settings and apply the OIDC settings to the appropriate Form.io field settings.

#### **Client ID and Secret Key**

1. Navigate to the **Entra ID** dashboard, click **App registrations**, and select your application

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FogtjxVIGd5CgyLKTVapH%2Fappaccess.jpg?alt=media&#x26;token=cbb8ef1d-3ec6-44e7-ad3c-7d8616cf0e42" alt=""><figcaption></figcaption></figure>

2. Within your Entra ID Application, click the **Overview** tab
3. Copy the **Application (client) ID** value and **Secret** from the [**Client Secret Step**](#creating-client-secret)

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Ftq89wSNf4ksmSPNkVbZy%2Fappregistryendpointid.jpg?alt=media&#x26;token=63f1c28e-b2b8-4815-aa8f-54c4f8474199" alt=""><figcaption></figcaption></figure>

4. Navigate to the OAuth settings within your Form.io project\
   **Settings** > **Authentication > OAuth**

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FywaOATjkZv158Riq7BYt%2Foauth1.png?alt=media\&token=f3c262b3-7f1e-4f81-82bd-85336f96815e)

5. Paste the OIDC **Application** (**Client) ID** and **Client Secret** to the correlated Form.io field settings

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FiwogjctkkWYlhDy4wpNp%2Fclientidsecret.jpg?alt=media&#x26;token=1c8b59e0-2165-4cee-870b-ff3acaa1ef24" alt="" width="563"><figcaption></figcaption></figure>

#### Well-Known Configuration

1. Within Entra ID,  click the **App registrations** tab and select the **OIDC Application**
2. Click the **Overview** tab and then **Endpoints**
3. **Copy** the ***OpenID Connect metadata document*** ULR and open it in a browser

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FI20qZBX4wAbXXDgltO7O%2Fwellknown.jpg?alt=media&#x26;token=245a4c20-d64e-49d1-b106-e6ec30a77757" alt=""><figcaption></figcaption></figure>

The Endpoints will look something like this:

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FHJPxkKMqRUW38WBW8GYx%2Fwellknownendpoints.jpg?alt=media&#x26;token=cbf26bb2-bc13-40b3-95a2-0815c1886b33" alt=""><figcaption></figcaption></figure>

4. Add the following endpoints from the Well-known configuration to the correlated field settings

<table><thead><tr><th width="350.10015869140625">Form.io Setting</th><th>Well-known Config</th></tr></thead><tbody><tr><td>Authorize URI </td><td>authorization_endpoint</td></tr><tr><td>Token URI</td><td>token_endpoint</td></tr><tr><td>User Info (claims) URI</td><td>userinfo_endpoint</td></tr></tbody></table>

5. Input the following values within the **Scope** setting **openid** | **email**

{% hint style="info" %}
The `openid` and `email` scopes are **required** for all OIDC providers and must be configured in your project's OpenID settings to ensure user authentication
{% endhint %}

Your Form.io Authorization settings should look something like this

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FS6W4YpK2hDsPwp8q4yoZ%2Fauth%20settings.jpg?alt=media&#x26;token=b4ebe411-1601-42e6-b147-efe6039070f7" alt=""><figcaption></figcaption></figure>

**Configure Login Form**

Configure the Form.io User Login form to support the Auth0 Authentication within your application.

1. Navigate to the Form.io project and **edit** the application's **Login** form.
2. Add a **Button** component
3. Within the Button settings, set the **Action** to **OAuth**
4. Set the **OAuth** **Provider** to **OpenID**
5. **Save** the form

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FbAestRXf9XdCDKanuKHt%2Fbutton.jpg?alt=media&#x26;token=6e96b3c2-a7e5-47b6-97d1-c387f6367d45" alt=""><figcaption></figcaption></figure>

**OAuth Action**

Once the Login form has been configured, an OAuth action will be added to the form to facilitate the OIDC authentication process.

1. Navigate to the **Login** form within the Form.io Project
2. Click the **Action** tab and add the **OAuth** action
3. Click the **OAuth Provider** setting and select **OpenID**
4. Click the **Action** setting and select **Remote Authentication**
5. Click the **Sign-in with OAuth Button** setting and select the **OIDC Button**
6. If you are mapping roles, add the following setting to the **Assign Roles** setting fields

   * The **Claim** setting will be the claim name (**Group** **Object ID)** that supports roles within the OIDC scope.
   * The **Value** setting will be the **Group ID** for the Entra ID Group.

   <figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F4XtZjAKklvwe2YzB3Yjf%2Fgroups.png?alt=media&#x26;token=44ea8696-d7ee-4b98-867b-c84a477ff8ab" alt=""><figcaption></figcaption></figure>

   * The **Role** setting is the Form.io role that should be assigned to users with the given OIDC Role

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FRI4O1Kpqc86Xhgm5WK2W%2Floginaction.png?alt=media&#x26;token=6dc96f0d-a8fe-4a11-8d28-83ee04932463" alt=""><figcaption></figcaption></figure>

7. **Save** the Action

### Testing Authentication

Test the authentication workflow to ensure it functions correctly. &#x20;

1. Navigate to your Applications authentication page and click the **SSO with OIDC** button.&#x20;
2. Enter the **OIDC** **credentials** into the **Microsoft** authentication page

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FY6BVwqFpYnqCSM7BNjcI%2Fimage.png?alt=media&#x26;token=7b2ec2cd-0806-407b-9fd0-27fd374d7b2b" alt=""><figcaption></figcaption></figure>

3. Once authenticated, the OIDC user should carry the **OIDC** **Group** **Role** (group id) as well as the mapped **Form.io Role ID** within the metadata of the user object.

## Auth0

This section explains how to set up the [**Auth0 Provider** ](https://auth0.com/)OIDC application and integrate it with the Form.io Project. Remote Authentication will be configured for the application linked to the project, allowing user validation through credentials stored with the OIDC provider. This ensures authentication occurs independently of any Form.io data, keeping OIDC user information fully decoupled from the Form.io project.

### Create and Configure Application

1. Access the [**Auth0 Admin dashboard**](https://manage.auth0.com/dashboard)
2. Click the **Applications** tab
3. Click the **+Create Application** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FJPq9vnLxLjYu211UvTcW%2Fcreateapplication2.jpg?alt=media&#x26;token=9bc2fafb-6ac7-4115-9760-81098e4805d1" alt=""><figcaption></figcaption></figure>

4. Give the Application a **Name** and click the **Create** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FH2CdlJ5aYqkWTubTPV70%2FCreate%20Application.jpg?alt=media&#x26;token=7a9509f4-980b-43be-a2c1-91718ebb4faf" alt=""><figcaption></figcaption></figure>

5. Within the Application, click the **Setting** tab

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FP3TAfbAjBS9poC3la3sH%2Fappsettings.jpg?alt=media&#x26;token=046e37bd-5cfa-4ba8-95fe-f958b9e8ec93" alt=""><figcaption></figcaption></figure>

5. Navigate to the Application URIs section and add the application  endpoint to the **Allowed Callback URLs**\
   `https://myapplication.com/dashboard`

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FgwcdoFWWxwQpUakQTIij%2Fcallbackurls.jpg?alt=media&#x26;token=3d46a498-83fb-42eb-b0a3-7b046fa2ab87" alt=""><figcaption></figcaption></figure>

6. **Save** the settings

### Create User

After configuring the application, set up your user base in the Auth0 dashboard. Assign users to Auth0 Roles, which can then be mapped to corresponding Form.io Roles.

1. In the Auth0 admin dashboard, navigate to **User Management** and select **Users**
2. Click the **+Create User** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FEuohB9JV7jZ6Fyv4nFrG%2Fcreatusers.jpg?alt=media&#x26;token=62f800a5-58e0-4cda-a9bb-c04e9121077a" alt=""><figcaption></figcaption></figure>

3. Input user **credentials** and click **Create**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F7p5a6zLWRacDwsJdIkd3%2Fcreateuser.jpg?alt=media&#x26;token=ac99d9c0-5305-4f89-8168-9f7078a7b195" alt="" width="483"><figcaption></figcaption></figure>

4. Add **additional** **users** to assign to the roles that will be configured in the next step.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FoGUnUeshUpvBAP07RVmS%2Fusertable.jpg?alt=media&#x26;token=b9c225d1-91c0-4d52-8757-a10cbff86458" alt=""><figcaption></figcaption></figure>

### Create and Assign Roles

Once users are set up, the next step is to create roles for OIDC users. These roles establish the mappings between OIDC roles and Form.io role assignments.

1. Under the **User** **Management** tab, click **Roles**
2. Click **Create Role**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FOwpF7fZ9sSQ849LnX8qA%2FRoles.jpg?alt=media&#x26;token=c8209916-8539-488e-9070-675da5406ee4" alt=""><figcaption></figcaption></figure>

3. Enter a **Name** and **Description** for the role, then click **Create**.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FVk9BoYZaUD5QGToLSSOU%2Frole1.jpg?alt=media&#x26;token=d4e1c35b-e13d-4e82-a85e-40bcbbb46bde" alt="" width="480"><figcaption></figcaption></figure>

4. Within the Role tab, select a **Role** created in the previous step

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FBJ4sScLm8qzzjPJrEEYX%2Frolelist.jpg?alt=media&#x26;token=4f38def1-55af-417c-988a-84a21e0d142c" alt=""><figcaption></figcaption></figure>

5. Click on the **Users** tab
6. Click **Add Users**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FpFiEkIO1Gn6emK7K6w0D%2FCapture.PNG?alt=media&#x26;token=36cbc45a-9841-4d25-82e9-44bda91cef0b" alt=""><figcaption></figcaption></figure>

7. Search and select the user to add to this Role and click **Assign**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FEzGSBlgNxKdTEIiEKOCM%2Faddusertorole.jpg?alt=media&#x26;token=882de2e5-3749-4827-b644-d3fb06fa27be" alt="" width="482"><figcaption></figcaption></figure>

8. Assign users to additional Roles you might have created in the previous steps

### Implementing Custom Actions to Assign Form.io Roles

In order to assign the Roles created in Auth0 and map them to a Form.io login, a custom Post-Login Action in Auth0 to required to map Form.io roles in the ID token. After creating and coding the action, deploy it and attach it to the Post-Login trigger to ensure it runs after user login.

1. Under the **Actions** tab click **Library**&#x20;
2. Click the **Create Action** dropdown then select **Create Custom Action**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FqZ2p0ylc3hjp2EWzUKC0%2Fcreateaction.jpg?alt=media&#x26;token=37c609ed-bd92-4985-ba5f-6cb0a229c2cc" alt=""><figcaption></figcaption></figure>

3. Give the action a **Name**
4. Set the **Trigger** to **Login / Post Login**
5. Set **Runtime** to **Node 18** and click **Create**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F9YRbjaDUtF13idzMJ7xC%2Fbitmap.png?alt=media&#x26;token=1e209893-0b77-47da-ad74-c4bf126e7dcf" alt="" width="453"><figcaption></figcaption></figure>

6. **Add** the following **code** within the **onExecutePostLogin** function

```typescript
exports.onExecutePostLogin = async (event, api) => {
  if(event.authorization){
    api.idToken.setCustomClaim('formioRoles', event.authorization.roles);
  }
};

```

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F9gSSVhjXSoYaeb2y7bMY%2Fimage.png?alt=media&#x26;token=e155d6cb-2fdf-42c8-a331-5f8efc801968" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Note: you cannot .setCustomClaim('groups', ...) or .setCustomClaim('roles', ...)
{% endhint %}

7. Click the **Deploy** button
8. Under the **Actions** tab, click on **Triggers**
9. Click the **post-login** trigger
10. Click the **Custom** tab
11. Drag your action in between **Start** and **Complete**
12. Click **Apply**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FtFaezYMmx2GldSU7uKUa%2Faddtrigger.jpg?alt=media&#x26;token=d583af23-01d5-4e98-a95b-b5f4f3afb846" alt=""><figcaption></figcaption></figure>

### **Form.io Integration**

Once the OIDC application is properly configured, information from the application will be used to integrate the application with the Form.io project. Navigate to the Form.io Project settings and apply the OIDC settings to the appropriate Form.io field settings.

#### **Client ID and Secret Key**

1. Navigate to your Auth0 Application and click the **Settings** tab
2. Copy the **Client ID** and **Client Secret**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FQEYLclWmABgAotYCgLfF%2Foidcinfo.png?alt=media&#x26;token=1f01b2a8-b894-40bb-9241-dd5d0e631c17" alt=""><figcaption></figcaption></figure>

3. Navigate to the **Form.io Project** Auth0 authentication should be applied to
4. Access the **OAuth** settings\
   **Settings** > **Authentication > OAuth > OpenID**

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FywaOATjkZv158Riq7BYt%2Foauth1.png?alt=media\&token=f3c262b3-7f1e-4f81-82bd-85336f96815e)

5. Paste the OIDC **Client ID** and **Client Secret** to the correlated Form.io field settings

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FiwogjctkkWYlhDy4wpNp%2Fclientidsecret.jpg?alt=media&#x26;token=1c8b59e0-2165-4cee-870b-ff3acaa1ef24" alt="" width="563"><figcaption></figcaption></figure>

#### Well-Known Configuration

1. Within your Auth0 Application, click the **Settings** tab
2. Scroll down the Settings page and expand the **Advanced Settings**
3. Click the **Endpoints** tab

   <figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FbIxlVLGq5imlONHP6O3Y%2Fendpoints2.jpg?alt=media&#x26;token=d80ad317-4eb1-4670-8d75-b2d94bd5fcdc" alt=""><figcaption></figcaption></figure>

The endpoint information will look something like this:

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fiypyt1yJKPpQjiEasB6r%2Fendpointsurls.jpg?alt=media&#x26;token=0ae60d25-133f-4220-8106-653c30841bb6" alt="" width="563"><figcaption></figcaption></figure>

4. Add the following endpoints  Well-known configuration endpoints and map them to the **corresponding** **fields** in your Form.io settings.

| Form.io Setting        | Well-known Configuration |
| ---------------------- | ------------------------ |
| Authorize URI          | OAuth Authorization URL  |
| Token URI              | OAuth Token URL          |
| User Info (claims) URI | OAuth User Info URL      |

5. Input the following values within the **Scope** setting\
   **openid**  | **email**

{% hint style="warning" %}
The `openid` and `email` scopes are **required** for all OIDC providers and must be configured in your Form.io project's OpenID settings to ensure successful user authentication."
{% endhint %}

Your settings should look something like this

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FyeTmWIMOBv8UPRcs5QiZ%2Foidcsettings.jpg?alt=media&#x26;token=aa8a4012-dd5f-4b3a-af19-43ca7c8d42ee" alt=""><figcaption></figcaption></figure>

#### **Configure Login Form**

Configure the Form.io User Login form to support the Auth0 Authentication within your application.

1. Navigate to the Form.io project and **edit** the application's **Login** form.
2. Add a **Button** component&#x20;
3. Within the Button settings, set the **Action** to **OAuth**&#x20;
4. Set the **OAuth** **Provider** to **OpenID**
5. **Save** the form

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FbAestRXf9XdCDKanuKHt%2Fbutton.jpg?alt=media&#x26;token=6e96b3c2-a7e5-47b6-97d1-c387f6367d45" alt=""><figcaption></figcaption></figure>

#### **OAuth Action**

Once the Login form has been configured, an OAuth action will be added to the form to facilitate the  OIDC authentication process.

1. Navigate to the **Login** form within the Form.io Project
2. Click the **Action** tab and add the **OAuth** action
3. Click the **OAuth Provider** setting and select **OpenID**
4. Click the **Action** setting and select **Remote Authentication**
5. Click the **Sign-in with OAuth Button** setting and select the **OIDC Button** &#x20;
6. If you are mapping roles, add the following setting to the **Assign Roles** setting fields

   * The **Claim** setting defines the claim name that carries role information within the OIDC scope. Use the same name specified in **Step 6** of the [**Custom Action**](#implementing-custom-actions-to-assign-form.io-roles)  section in the Auth0 setup.

   <figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FOpHu0OGdfK47c8hJxFv9%2Fjscustomaction.jpg?alt=media&#x26;token=951abb33-2cd9-4980-8d15-2f8f3d9baa60" alt=""><figcaption></figcaption></figure>

   * The **Value** setting will be the identifier for the OIDC Group. Use the same **Role** name specified in **Step 3** of the [**Create and Assign Roles**](#create-and-assign-roles) section in the Auth0 setup.
   * The **Role** setting is the Form.io role that should be assigned to users with the given OIDC Role.
7. **Save** the Action settings

{% hint style="info" %}
In the example below OIDC users with the **Member** role will authenticate into the application with the Form.io **Authenticated** role. OIDC users with the **Admin** role will authenticate into the application with the Form.io **Administrator** role.
{% endhint %}

| Claim (OIDC) | Value (OIDC) | Role (Form.io) |
| ------------ | ------------ | -------------- |
| formioRoles  | admin role   | Administrator  |
| formioRoles  | user role    | Authenticated  |

<div data-full-width="false"><figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fs6MaShG4O5SrUUWfZcnq%2FOAuthsettings.png?alt=media&#x26;token=493eb9bd-a675-4b8f-a7d2-6ebd2a150b67" alt=""><figcaption></figcaption></figure></div>

### Testing Authentication

Test the authentication workflow to ensure it functions correctly. &#x20;

1. Navigate to your Applications authentication page and click the **SSO with OIDC** button.&#x20;
2. Enter the **OIDC** **credentials** into the OneLogin authentication page

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FHa5lwgyVHm8NCCaggvdc%2Fauth0.jpg?alt=media&#x26;token=02d99837-305c-4089-93fc-792c0f204f4a" alt="" width="305"><figcaption></figcaption></figure>

3. Once authenticated, the OIDC user should carry the **OIDC** **Group** **Role** (Member) as well as the mapped **Form.io Role ID** within the metadata of the user object.

## Token Swap

One type of application design is where form.io forms are embedded in an existing application that already has OAuth authentication built into it. In this type of application, the OAuth token can be exchanged for a form.io token to enable all future interactions with form.io to be authenticated using the new form.io token.

To do this, you should have an existing Bearer (or other) authorization token from the OAuth provider. You also need to set up the OpenID and OpenID Connect settings in your project.

Then, instantiate the Formio library with your project URL and call the currentUser endpoint with your authorization header.

```json
var header = new Formio.Headers();
header.set('Authorization', 'Bearer 2e762950-9498-4079-a699-xxxxxxxxxxxx');

Formio.setBaseUrl('https://yourdomain.com');
Formio.setProjectUrl('https://yourdomain.com/yourproject');
var formio = new Formio('https://yourdomain.com/yourproject');
formio.currentUser({
  external: true,
  header: header,
});
```

{% hint style="info" %}
To perform a Token Swap, it is required to expose the /UserInfo endpoint
{% endhint %}

Form.io will use the authorization token to request the OAuth endpoint, receive the user information, and create a new form.io token that is passed back to the form.io library and used on subsequent requests.

## OIDC - Developer Portal

To enable SSO in the Developer Portal, simply apply all the configurations detailed above, but apply the configurations to the **Portal Base** project. Utilizing the Remote Authentication method will set up authentication for the Developer Portal application, eliminating the necessity for resource-based authentication. Follow the link below for a detailed walkthrough:

[**SSO Authentication Into Developer Portal Using OIDC**](#user-content-fn-5)[^5]

## OIDC - Form Manager Application&#x20;

The same concepts above can be applied to the Form Manager application. Since the Form Manager utilizes the Admin Login form for authentication, the only difference between this workflow and the previous SSO example is the form being modified is the Admin Login form instead of User Login.

#### OIDC Provider Application

&#x20;1\. Create an application within your OIDC provider (in this example auth0) and choose Single Page application type.

![](https://gblobscdn.gitbook.com/assets%2F-MPHoF2HwOA0s5HV_AIB%2F-MbHdEabkqwq1Igu9AC5%2F-MbHgIgCB2XOuZmHLA6H%2Fimage.png?alt=media\&token=168eec8a-3001-470f-b339-f21daad47ad7)

![](https://gblobscdn.gitbook.com/assets%2F-MPHoF2HwOA0s5HV_AIB%2F-MbHdEabkqwq1Igu9AC5%2F-MbHfJD7-KiXfb3TBEz6%2Fimage.png?alt=media\&token=b02dc97f-99fa-48d9-94d4-c98ef8f4719a)

#### Open ID Application Configuration

Gather the Client ID and secret as well as the necessary endpoints found within the [**well-known** ](#how-do-i-find-my-uri-endpoints)endpoint for your application.&#x20;

![](https://gblobscdn.gitbook.com/assets%2F-MPHoF2HwOA0s5HV_AIB%2F-MbHdEabkqwq1Igu9AC5%2F-MbHhY_XfB7mZkBl9O9Z%2Fimage.png?alt=media\&token=ded09e8f-6fe1-4497-a6df-8a252f353979)

```
https://dev-abcdefghij.us.auth0.com/.well-known/openid-configuration
```

```
{
    "issuer": "https://dev-abcdefghij.us.auth0.com/",
    "authorization_endpoint": "https://dev-abcdefghij.us.auth0.com/authorize",
    "token_endpoint": "https://dev-abcdefghij.us.auth0.com/oauth/token",
    "device_authorization_endpoint": "https://dev-abcdefghij.us.auth0.com/oauth/device/code",
    "userinfo_endpoint": "https://dev-abcdefghij.us.auth0.com/userinfo",
    "mfa_challenge_endpoint": "https://dev-abcdefghij.us.auth0.com/mfa/challenge",
    "jwks_uri": "https://dev-abcdefghij.us.auth0.com/.well-known/jwks.json",
    "registration_endpoint": "https://dev-abcdefghij.us.auth0.com/oidc/register",
    "revocation_endpoint": "https://dev-abcdefghij.us.auth0.com/oauth/revoke",
    "scopes_supported": ["openid", "profile", "offline_access", "name", "given_name", "family_name", "nickname", "email", "email_verified", "picture", "created_at", "identities", "phone", "address"],
    "response_types_supported": ["code", "token", "id_token", "code token", "code id_token", "token id_token", "code token id_token"],
    "code_challenge_methods_supported": ["S256", "plain"],
    "response_modes_supported": ["query", "fragment", "form_post"],
    "subject_types_supported": ["public"],
    "id_token_signing_alg_values_supported": ["HS256", "RS256"],
    "token_endpoint_auth_methods_supported": ["client_secret_basic", "client_secret_post"],
    "claims_supported": ["aud", "auth_time", "created_at", "email", "email_verified", "exp", "family_name", "given_name", "iat", "identities", "iss", "name", "nickname", "phone_number", "picture", "sub"],
    "request_uri_parameter_supported": false
}
```

#### Form.io Project Configuration

Navigate to the Form.io Project the Form Manager application is connected to. Navigate to the **Authorization** > **OAuth** > **OpenID** settings.

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FTpezWP8zwdGrYh5jV2A3%2Foauth16.png?alt=media\&token=ec4ed57b-3e03-402e-838d-b6a01d5d4743)

Apply the information from the OIDC application and **well-known** endpoint.

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F83Nf2UpCYv71JuJ9g4Om%2Foauth17.png?alt=media\&token=be4d6c19-dad5-4c22-96b3-357118945dc0)

#### Setting Up OpenID Login Button

1. Within your Project, navigate to the **Admin** Login form.&#x20;
2. Add a **Button Component**&#x20;
   * Select the **OAuth** action
   * Select the **OpenID** provider&#x20;
   * Save settings.

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FqMVZdNyXpwg6tGOnmGit%2Foauth18.png?alt=media\&token=54cee414-2fb0-47d3-8e73-4dfb23255f7c)

3. Navigate to the **Action** tab and add the **Oauth** Action.

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F4WpSf1fao1HKne6bilHG%2Fadminlogin.jpg?alt=media\&token=c5430375-fe87-4130-8dfb-8368c44e0db6)

4. Configure the **OAuth** action&#x20;
   * Select your **OAuth** provider
   * Select the **Remote** **Authentication** Action&#x20;
   * Select the **SSO** button within the Admin login form
   * Since the Form Manager requires Administrative users, select the **Administrator** Role&#x20;

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FANDtivSC7KLxrvogyPh7%2Foauth20.png?alt=media\&token=94d4bbca-6d24-43e6-b9df-87bf18df6acd)

#### **Workflow Testing**

1. Launch the **Form Manager** application&#x20;
2. Click the **Login with OIDC** button
3. Enter your **OIDC** User **credentials**

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FQ57LxKvhUwBWkZo0IJj6%2FFormManagerlogin.jpg?alt=media\&token=220fba26-0a5c-4380-b3ae-4ec4a16ed261)

You should authenticate into the Form Manager application

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F5dbuIM5re3HDrHDzegkY%2FFormManager.jpg?alt=media&#x26;token=f1efd8bc-5f14-48bf-a7d4-56429aa413a6" alt=""><figcaption></figcaption></figure>

[^1]: The URL to which Auth0 redirects users after they authenticate from the Allow Origin domain

    Other terms for the Callback:

    Redirection URI

    Redirection URL

    Redirect URI

    Redirect URL

    Callback URI

[^2]: authorization\_endpoint

[^3]: token\_endpoint

[^4]: userinfo\_endpoint

[^5]:
