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

# Organizations for B2B Apps: Members, Roles and Company SSO

> Model your business customers as organizations in Didit Authentication, with members, roles, invitations, verified domains, auto-join and their own SSO.

Didit Authentication's organizations let a B2B application group its users by the company they work for.
Each organization has its own members and roles, can verify its email domains so colleagues join automatically, and can sign its people in through its own SAML or OIDC identity provider.
Your app reads the person's organizations and roles from their token and session, and decides what each role may do.

> [!NOTE]
>
> An organization here is one of **your** customers, inside your application.
> It is separate from your Didit organization, which holds your own team in the Business Console.

## Turn organizations on

Organizations are off for a new application.
Open **Authentication > Organizations** in the console, and in its **Settings** card:

* Turn on **Organizations**.
* Choose the **Default role for new members**, the role people get when they join through a verified domain or single sign-on (`member` by default).
* Keep **Require MFA for organization admins** on, the default MFA policy (see [below](#mfa-for-organization-admins)).

You then manage organizations in the console: **New organization** creates one with its name and a slug, unique in the application.
Your organizations are created by your team; people cannot create their own organizations from your app yet.
Give each organization its logo: open it and choose **Upload logo**, a PNG, JPEG or WEBP image of up to 2 MB (a square image looks best), and **Change logo** or **Remove logo** later.
The logo shows in the list, on the organization's page and on the hosted approval screen where people choose the organizations an agent may use; an organization without one shows its first letter.
The list shows each organization's members, verified domains, single sign-on status, MFA rule and creation date, and the key metrics above it count organizations, members, SSO connections and verified domains.

![The Organizations page in the Didit Business Console, with key metrics and a list of organizations with their logos, members, verified domains and single sign-on status](https://mintcdn.com/didit-0f962782/aCkOB-aX-4EsuXCZ/images/authentication/console-organizations.png?fit=max\&auto=format\&n=aCkOB-aX-4EsuXCZ\&q=85\&s=f7314837ab507cb42d5bc8f329577b79)

Authentication > Organizations.

## Members and roles

A person can belong to several organizations of your application, with one role in each.

| Role | Meant for |
| - | - |
| `admin` | People who manage the organization in your app. |
| `member` | Everyone else. The default role. |
| `billing` | People who handle the organization's billing in your app. |

On the Scale and Enterprise plans, and in every Sandbox application, you can also define **custom roles**, each with a key and the permissions your app checks, for example `payouts.approve`.
A member can hold a custom role on top of their role.

Open an organization to see its single sign-on, verified domains, members, roles and invitations.
A member who signed in with Google or GitHub shows the photo of that account.

![An organization opened in the Didit Business Console, showing its logo, its SAML single sign-on with a setup link, a verified domain with its auto-join switch, and its members with their photos and roles](https://mintcdn.com/didit-0f962782/aCkOB-aX-4EsuXCZ/images/authentication/console-organization-detail.png?fit=max\&auto=format\&n=aCkOB-aX-4EsuXCZ\&q=85\&s=87180cb96f2c993156d9dd417d4a1280)

An organization's single sign-on, verified domains, members and roles.

## Invitations

Choose **Invite member** on an organization, enter up to 20 email addresses and the role they get (`admin`, `member` or `billing`), and Didit emails each person an invitation.
An invitation lasts 7 days and opens the hosted `/invite` page on your sign-in origin, where the person signs in or creates an account and joins.
The organization's **Invitations** list shows when each one expires, with **Resend** and **Revoke**.

## Verified domains and auto-join

An organization can prove it owns an email domain:

1. Add the domain to the organization.
2. Add the TXT record Didit shows at `_didit-auth.<domain>` with your DNS provider, containing the verification token.
3. Check the domain. It shows as **Verified** once the record is found.

With **Auto-join** on for a verified domain, a person who signs in with a verified email address at that domain joins the organization automatically, with your default role.
A domain can auto-join only one organization of your application.

## Company single sign-on

An organization can sign its people in through its own identity provider, with SAML or OIDC.

* **Setup link.** Choose **Copy setup link** in the organization's **Single sign-on** card and share it securely with the organization's IT admin. It works for seven days and walks them through the connection. Setup links need the Scale or Enterprise plan; Sandbox applications have them on any plan.
* **SAML.** Your service provider metadata is published at `{origin}/sso/saml/metadata/`.
* **Finding the connection.** The hosted sign-in page finds the organization's connection from the person's verified email domain, from **Use single sign-on**, or from `organization=<slug>` on the sign-in URL.
* **Status.** The organization list shows whether each connection is active, not set up, or waiting on a setup link that was sent.

People who sign in through an organization's identity provider join it with your default role.
The configuration fields of each protocol are in [sign-in methods](https://docs.didit.me/authentication/sign-in-methods.md#organization-sso).

## MFA for organization admins

The default MFA policy, `organization_admins`, requires a second factor from every person who holds the `admin` role in any organization of your application.
A person who becomes an admin must enroll a factor, and `GET /session/` stops accepting their session until the session meets the policy again.
Change the policy under **Authentication > Security and sessions**, or with `mfa_policy` in [application settings](https://docs.didit.me/authentication/overview.md#application-settings).

## Read organizations in your app

While organizations are on, the person's tokens and session tell your app where they belong:

| Where | What it holds |
| - | - |
| `org` claim in the access and ID tokens | `{"id", "role"}` of the person's earliest organization membership, or `null`. |
| `organizations` in `GET /session/` | Every membership, with `organization_id`, `organization__name`, `role` and `custom_role` (`key` and `permissions`, or `null`). |
| `organizations` in the SDK session | The same list, for example `session.organizations` in JavaScript and `user.organizations` in React. |

```json theme={null}
{
  "organizations": [
    {
      "organization_id": "3e9a1f0b-5c2d-4e7f-8a6b-9c0d1e2f3a4b",
      "organization__name": "Northwind",
      "role": "admin",
      "custom_role": {"key": "approver", "permissions": ["payouts.approve"]}
    }
  ]
}
```

Check the role and permissions on your backend, from a verified token or `GET /session/`, before every action that depends on them.
When organizations are off, `org` is `null` and the list is empty.

## Import existing organizations

When you [import users](https://docs.didit.me/authentication/migration.md) from another platform, you can bring their organization memberships with them.
See [social links, authenticators and organizations](https://docs.didit.me/authentication/migration.md#social-links-authenticators-and-organizations).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.