> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e2b.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Single sign-on (SSO)

> Let members of your workspace sign in to E2B through your identity provider with OpenID Connect. Verify your email domain, add a connection, and optionally add people automatically and require SSO.

**Single sign-on (SSO)** lets the people in your organization sign in to E2B through your identity provider (IdP), such as Okta, instead of with a separate E2B password. You connect your IdP to a [workspace](https://docs.e2b.dev/workspaces.md) with OpenID Connect (OIDC), and anyone with an email address on your verified domain is sent to your IdP when they sign in.

For a step-by-step walkthrough with a specific provider, see [Set up SSO with Okta](https://docs.e2b.dev/sso/okta.md).

## Requirements

* **The SSO add-on.** The workspace needs the SSO add-on, either purchased or granted by E2B. Without it, you can't create a connection or turn on just-in-time provisioning or Require SSO. Connections you already have keep working if the add-on lapses, and you can still edit or remove them.
* **A workspace owner.** Only workspace owners can manage SSO.
* **A team workspace.** Personal workspaces can't use SSO. [Create a workspace](https://docs.e2b.dev/workspaces.md) first.
* **An OIDC identity provider.** Your IdP must support OpenID Connect with the authorization code flow and PKCE.
* **An email domain you own.** You need access to its DNS settings to publish a TXT record. Don't use a personal email domain such as `gmail.com`.

You manage SSO in the [E2B Console](https://console.e2b.dev/sign-in?signup_source=docs_console), under the workspace's **Settings → SSO**. The **Workspace SSO** page has four cards: **Domain**, **Single sign-on**, **Just-in-time provisioning**, and **Require SSO**.

![The Workspace SSO page in the E2B Console with empty Domain, Single sign-on, Just-in-time provisioning, and Require SSO cards](https://mintcdn.com/e2b/TRevOe273B2zkCGr/images/sso/e2b-01-sso-page.png?fit=max\&auto=format\&n=TRevOe273B2zkCGr\&q=85\&s=f659774a9df8307887053e8afadc341a)

## How setup works

1. **[Verify your domain](#verify-your-domain).** Publish a DNS TXT record to prove your organization owns its email domain.
2. **[Add an OIDC connection](#add-an-oidc-connection).** Register an app in your IdP and enter its details in E2B.
3. **[Turn on just-in-time provisioning](#just-in-time-provisioning)** (optional). Let people on your verified domain join the workspace when they first sign in with SSO.
4. **[Require SSO](#require-sso)** (optional). Allow only people who signed in with SSO to reach the workspace.

## Verify your domain

Verifying a domain proves that your organization owns it. It doesn't add anyone to the workspace. SSO sign-in starts once your domain is verified: from then on, people who sign in with an email address on that domain are sent to your IdP.

1. On the **Domain** card, enter your email domain, for example `your-company.com`, and click **Add domain**. Enter the root domain only, without `https://`, a subdomain, or a path.

2. The domain shows as **PENDING** together with a DNS record to publish:

   | Type | Name | Value |
   | :- | :- | :- |
   | `TXT` | `_e2b-challenge.<your-domain>` | `e2b-domain-verification=<token>` |

3. Add the TXT record at your DNS provider.

4. Click **Check verification**. When E2B finds the record, the domain shows as **VERIFIED**.

DNS changes can take a few minutes to become visible. If the check doesn't pass right away, wait and click **Check verification** again.

![The Domain card showing a PENDING domain with the TXT record type, name, and value to publish, and the Check verification button](https://mintcdn.com/e2b/TRevOe273B2zkCGr/images/sso/e2b-03-domain-txt-record.png?fit=max\&auto=format\&n=TRevOe273B2zkCGr\&q=85\&s=5abfdef564111a6e849a3a70154ab648)

A verified domain can belong to only one workspace. When you remove a domain, it shows as **REMOVING** briefly and is then no longer verified for your workspace, so another workspace can claim it.

## Add an OIDC connection

First, register an OIDC app (sometimes called a client or app integration) with your IdP:

* **Redirect URI:** copy the **Callback URL** shown on your SSO page. In production, it's `https://auth.e2b.dev/self-service/methods/oidc/callback`.
* **Flow:** authorization code with PKCE (S256).
* **Scopes:** `openid`, `email`, and `profile`.

Then fill in the **Single sign-on** card in E2B:

* **Connection name**: shown to people on the sign-in button, as **Sign in with \<Connection name>**.
* **Issuer URL**: your IdP's issuer, for example `https://your-company.okta.com`.
* **Client ID** and **Client secret**: from the app you registered.

Click **Save connection**. The card shows **CONFIGURED** with the connection name, issuer URL, client ID, and callback URL.

> [!WARNING]
>
> Saving a connection turns off email invitations for the workspace and revokes any pending invites. From then on, people join through your IdP with [just-in-time provisioning](#just-in-time-provisioning).

![The Single sign-on card showing a CONFIGURED connection with its name, Issuer URL, Client ID, Callback URL, and Edit and Remove buttons](https://mintcdn.com/e2b/TRevOe273B2zkCGr/images/sso/e2b-06-connection-configured.png?fit=max\&auto=format\&n=TRevOe273B2zkCGr\&q=85\&s=de01e1194faec36519880ca0c9a0b930)

A saved connection hasn't been tested yet, and SSO isn't enforced. Sign in with SSO yourself to check that it works.

## Just-in-time provisioning

With **Just-in-time provisioning** on, people who sign in with SSO from a verified domain are added to the workspace as **Viewers** the first time they sign in. Their email must be on a verified domain, and they must have confirmed it with E2B. See [Email confirmation](#email-confirmation).

* Owners can change a new member's role afterwards.
* Existing members keep their roles.
* Turning just-in-time provisioning off adds no one new and removes no one.

> [!NOTE]
>
> While just-in-time provisioning is on, a person you remove from the workspace is added back the next time they sign in with SSO. To keep someone out, remove them from the app in your IdP as well.

## Require SSO

With **Require SSO** on, only people who sign in with SSO can reach the workspace.

* It needs a saved connection.
* You must sign in with SSO yourself once before you can turn it on, so you don't lock yourself out.
* Members who don't sign in with SSO are suspended until they do. They keep their membership and role, but can't access the workspace.

The workspace's members list marks people who signed in with SSO as **sso**, and suspended members as **suspended**.

![The Just-in-time provisioning and Require SSO cards with their toggles](https://mintcdn.com/e2b/TRevOe273B2zkCGr/images/sso/e2b-07-jit-require-sso.png?fit=max\&auto=format\&n=TRevOe273B2zkCGr\&q=85\&s=986287d916291aa8581a346667a75101)

## Signing in with SSO

Members sign in from the usual E2B sign-in page:

1. Enter your work email and click **Continue**.
2. For an email on a verified domain, the page shows a single **Sign in with \<Connection name>** button. Click it.
3. Sign in at your IdP. Your IdP may also ask you to set up multi-factor authentication, depending on your organization's policies.
4. On your first SSO sign-in, E2B emails you a code. Enter it to confirm your email address.
5. You return to E2B, signed in.

Once a domain is verified, people can't create a new E2B account with a password for an email on that domain. The sign-up page tells them to sign in with your organization's SSO instead.

![The E2B sign-in page showing a single Sign in with Okta button for a work email on a verified domain](https://mintcdn.com/e2b/TRevOe273B2zkCGr/images/sso/signin-02-sso-button.png?fit=max\&auto=format\&n=TRevOe273B2zkCGr\&q=85\&s=c8d82c46ea3d601a8217e89b8ad9a9b6)

## Email confirmation

E2B confirms each person's email address itself. The first time someone signs in with SSO, E2B emails them a one-time code, and they enter it before they continue. Later SSO sign-ins don't ask again.

E2B ignores the `email_verified` claim from your IdP, because it doesn't prove that the person controls the mailbox. Your IdP doesn't need to send it.

## Existing E2B accounts

If someone already has an E2B account with the same email address, for example one they created with a password or with Google before you set up SSO, their first SSO sign-in shows **Link your account**:

> \<email> already has an E2B account. Sign in to it below once to start signing in with \<Connection name>.

They sign in once with the method they used before. From then on, SSO signs them in directly to the same account. If they forgot their password, they can use account recovery on that screen.

![The Link your account screen asking a person with an existing E2B account to sign in once with their previous method](https://mintcdn.com/e2b/TRevOe273B2zkCGr/images/sso/signin-05-link-account.png?fit=max\&auto=format\&n=TRevOe273B2zkCGr\&q=85\&s=d9df972cfe3a1db0ec59f03b74fe7c5e)

> [!WARNING]
>
> The email address in your IdP must match the one on the existing E2B account. If it differs, E2B treats the person as new and creates a separate account, and their old account isn't connected. For example, this happens when your company changes its email format from `firstname.lastname@` to `flastname@` before the person has used SSO. Have people sign in with SSO once before you change email formats in your IdP. If it already happened, contact [support@e2b.dev](mailto:support@e2b.dev) to merge the accounts.

## Change, rotate, or remove a connection

Click **Edit** on the **Single sign-on** card to change the connection:

* **Connection name**: change it at any time.
* **Client secret**: to rotate it, create a new secret in your IdP, enter it here, and save. Leave the field empty to keep the stored secret.
* **Client ID**: a new client ID also needs a new client secret.
* **Issuer URL**: can't be changed. To use a different issuer, remove the connection and add a new one.

Click **Remove** to delete the connection. When you remove it:

* People who signed in through it can no longer use it, and sign in with an email code or a method they had before.
* Workspace membership doesn't change.
* **Require SSO** is turned off.
* Verified domains stay verified.

## Troubleshooting

> [accordion] The sign-in page doesn't show the SSO button
>
> SSO sign-in starts only after the domain is verified. Check that the **Domain** card shows **VERIFIED** and that the email entered is on that domain.

> [accordion] Domain verification doesn't pass
>
> Check that the TXT record's name is `_e2b-challenge.<your-domain>` and its value matches the one on the **Domain** card exactly. DNS changes can take a few minutes to become visible, so wait and click **Check verification** again.

> [accordion] A person can't sign in at the identity provider
>
> Make sure they are assigned to the app in your IdP. In Okta, for example, only people assigned to the app can sign in through it.

> [accordion] A person signed in with SSO but wasn't added to the workspace
>
> Check that **Just-in-time provisioning** is on, that their email is on a verified domain, and that they entered the code E2B emailed them on their first sign-in. If the code didn't arrive, check their spam folder, or have them sign in again to get a new code.

> [accordion] A person ended up with a second, empty account
>
> The email in your IdP didn't match the email on their existing E2B account. See [Existing E2B accounts](#existing-e2b-accounts) and contact [support@e2b.dev](mailto:support@e2b.dev) to merge the accounts.

> [accordion] I can't turn on Require SSO
>
> Require SSO needs a saved connection, and you must have signed in with SSO yourself at least once. Sign out, sign in with SSO, and try again.

> [accordion] I removed someone and they came back
>
> With just-in-time provisioning on, people on your verified domain are added again the next time they sign in with SSO. Remove them from the app in your IdP to keep them out.

> [accordion] Can I still invite people by email?
>
> No. Once a connection is saved, email invitations are off and pending invites are revoked. People on your verified domain join through your IdP with just-in-time provisioning.

> [accordion] What happens if the SSO add-on lapses?
>
> Existing connections keep working, and you can still edit or remove them. You can't create a new connection or turn on just-in-time provisioning or Require SSO until the add-on is active again.
