# Single sign-on and directory sync

> Let people sign in with their company account (Okta, Microsoft Entra ID, Google Workspace or any OpenID Connect provider), and add and remove them automatically with SCIM.

With single sign-on, people sign in to Underpass with their company account instead of Google or an email code. With directory sync (SCIM), your identity provider adds people to the workspace and takes them out: when someone leaves the company and is turned off in Okta or Entra, they lose access to every machine at once.

Both are part of the **Business** plan. Owners and admins set them up in **Settings → Single sign-on**.

## 1. Verify your domain

Single sign-on works for the email domains your workspace has proved it owns.

1. Under **Domains**, add your company's domain, like `acme.com`.
2. Add the TXT record it shows to that domain's DNS: `underpass-domain-verification=…` on the domain itself (`@`).
3. Click **Verify**. DNS can take a few minutes to update.

A domain belongs to one workspace. Shared email domains such as gmail.com or outlook.com can't be added.

## 2. Connect your identity provider

Create an OpenID Connect web app in your identity provider, using the **redirect URI** the settings page shows (`https://app.getunderpass.com/auth/sso/callback`). Then pick your provider under **Identity provider**, enter the app's issuer, client ID and client secret, and click **Connect**.

A workspace has one identity provider at a time. To move from one to another, disconnect the first: people keep their Underpass accounts, matched by email.

### Okta

1. **Applications → Applications → Create App Integration**: choose **OIDC – OpenID Connect**, then **Web Application**.
2. Name it (for example *Underpass*) and keep **Authorization Code**.
3. **Sign-in redirect URIs:** `https://app.getunderpass.com/auth/sso/callback`. Leave the sign-out redirect URIs empty.
4. **Assignments:** everyone in your organization, or the groups who should get in. Save.
5. On the app's **General** tab, copy the **Client ID** and the **Client secret**.

In Underpass the **issuer** is your Okta address, `https://<your-org>.okta.com`.

### Microsoft Entra ID

1. **App registrations → New registration.** Name it, keep **Single tenant**, and add the redirect URI with the platform **Web**.
2. **Token configuration → Add optional claim:** token type **ID**, claim **email**, and let it turn on the Microsoft Graph email permission. Without it, Entra can send people's addresses in other forms, such as guests' `…#EXT#…` usernames.
3. **Certificates & secrets → New client secret.** Copy its **Value** (not the Secret ID): Entra shows it only once.
4. Copy the **Application (client) ID** and the **Directory (tenant) ID** from the app's Overview.

In Underpass the **issuer** is `https://login.microsoftonline.com/<tenant ID>/v2.0`.

The first time someone signs in, Entra may ask them to allow Underpass to read their profile and email.

### Google Workspace

In Google Cloud, as a Workspace admin: **APIs & Services → Credentials → Create OAuth client ID**, **Web application**, with the redirect URI. Make the consent screen **Internal**, so only your Workspace's people can use it. The **issuer** is `https://accounts.google.com`.

### Another provider

Any OpenID Connect provider works (JumpCloud, OneLogin, Auth0, Keycloak, Authentik and others), with the `openid`, `email` and `profile` scopes. Choose **Other** and enter your provider's issuer URL.

The client secret is stored encrypted, and nobody can read it back from the dashboard.

**New members' role.** People who sign in through single sign-on for the first time join as members, or as admins if you choose that.

### Signing in

On the sign-in page, people choose **Sign in with SSO** and enter their work email. They go to your identity provider and come back signed in, in the same account they'd have with Google or an email code. Two-step sign-in still applies if they've set it up.

## 3. Require single sign-on (optional)

Turn on **Require single sign-on** and everyone else in the workspace must sign in through your identity provider. Someone who signed in with Google or an email code is sent back to sign in again through it. The database enforces this, not only the dashboard.

The **owner** is the exception, so a broken or misconfigured identity provider can't lock everyone out. An admin who turns it on must have signed in through single sign-on first, so they know it works.

## 4. Directory sync with SCIM (optional)

SCIM lets your identity provider manage who's in the workspace:

- **People** assigned to the app are listed in the workspace's directory. They get an Underpass account the first time they sign in.
- **Turning someone off or removing them** in your identity provider takes them out of the workspace and ends their single sign-on sessions.
- **Groups** you push become groups in [access controls](/features/access-controls), named `group:dir-<name>`, so rules like "group:dir-engineering can reach the servers" follow the directory. The `dir-` prefix keeps them apart from groups you write yourself, which the directory never changes.

Once directory sync is on, only people your identity provider has synced can sign in through single sign-on.

Under **Directory sync**, click **Turn on directory sync** (or **New token**) and copy the token: it's shown once. Then set up provisioning in your identity provider. In both Okta and Entra, provisioning is a **second app** next to the one people sign in with.

### Okta

1. **Applications → Browse App Catalog**: add **SCIM 2.0 Test App (OAuth Bearer Token)**. Name it (for example *Underpass directory sync*); you can hide its icon from users.
2. **Provisioning → Configure API Integration**: turn on **Enable API integration**.
   - **SCIM 2.0 Base Url:** `https://app.getunderpass.com/scim/v2`
   - **OAuth Bearer Token:** the token.

   Click **Test API Credentials**, then **Save**.
3. **Provisioning → To App → Edit**: turn on **Create Users**, **Update User Attributes** and **Deactivate Users**. Save.
4. **Assignments**: assign the same people or groups as the sign-in app. Okta sends changes right away.

### Microsoft Entra ID

1. **Enterprise applications → New application → Create your own application**: name it (for example *Underpass directory sync*) and choose **Integrate any other application you don't find in the gallery (Non-gallery)**.
2. **Provisioning**: set the mode to **Automatic**, then under **Connectivity** (Admin credentials):
   - **Tenant URL:** `https://app.getunderpass.com/scim/v2`
   - **Secret token:** the token.

   Click **Test connection**, then **Create**.
3. **Users and groups**: assign the people who should be in the workspace.
4. Start provisioning. Entra syncs about every 40 minutes; **Provision on demand** sends one person through at once, to try it or to remove someone immediately.

On the free Entra plan, people are assigned one by one; assigning groups needs Entra ID P1 or P2.

To stop directory sync, revoke the token.

## Good to know

- A verified domain belongs to one workspace, and a workspace has one identity provider, so an email address always leads to exactly one place to sign in.
- People who sign in through single sign-on still count as users on your plan, the same as everyone else.
- Each sign-in through single sign-on is in the [audit log](/manage/logs#audit-log), and so is every change to these settings.
- Providers that only speak SAML (some ADFS, Ping or OneLogin setups) aren't supported yet. Most can also offer OpenID Connect.
- If the workspace leaves the Business plan, single sign-on and directory sync stop working until it's back. Everyone can still sign in with Google or an email code, and you can remove what's set up.
