Skip to content

Document joining organizations by company email domain - #301

Draft
tnkuehne wants to merge 1 commit into
mainfrom
domain-join-docs
Draft

tnkuehne wants to merge 1 commit into
mainfrom
domain-join-docs

Conversation

@tnkuehne

Copy link
Copy Markdown
Contributor

Documents joining organizations by company email domain, implemented in #300.

  • Members guide: joining from the organization chooser or the CLI, opening an organization to the domain an administrator's Google Workspace or Microsoft work sign-in proves, and reserving new organizations on a verified company domain.
  • API reference: allowDomainJoin on organization creation and the joining and settings endpoints.
  • CLI reference: --allow-domain-join, organizations joinable and organizations join.

Blocked until a published release includes #300. The pages name platform 0.7.21; update the version if that release differs.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 44be469 Nov 23 2026, 09:22 AM

@tnkuehne
tnkuehne force-pushed the domain-join-docs branch 2 times, most recently from 1f065ce to 7490fda Compare November 23, 2026 08:42
@tnkuehne
tnkuehne force-pushed the domain-join-docs branch 3 times, most recently from a69f96e to 14d67e9 Compare November 23, 2026 09:14
tnkuehne added a commit that referenced this pull request Nov 23, 2026
People at a company can now join its organization without an invitation.
An organization opens itself to a company email domain, and everyone
with a verified address on that domain sees it on the organization
chooser and joins as a member.

## Changes

- **Proof that a company owns the domain.** Only someone whose own
sign-in proves the domain can open an organization to it: a linked
Google Workspace account whose saved ID token names the domain as `hd`,
or a Microsoft work account with `xms_edov` outside the consumer tenant.
Better Auth saves these tokens at every sign-in, so no extra claim
storage is needed. An email code proves only a mailbox, so mail-provider
domains never qualify.
- **Creation.** The create form offers "Enable access for example.com",
on by default, when the creator's sign-in proves the domain.
`createOrganization` extensions still receive only `name` and `slug`.
- **Members settings.** Owners and admins see "Join by email domain":
the open domains, removal, and a button for the domain their own sign-in
proves. Removing a domain keeps everyone who already joined. Changes
apply optimistically and roll back on failure.
- **Joining.** The chooser lists organizations open to the person's
verified domain with one colleague from the same domain (never external
guests) and the number of other members, and a verified mark when the
organization verified that domain by DNS for company SSO. Joining checks
the domain again and adds the member under the settings lock that
removing a join domain takes, so a removal either ends the join or
follows it; the 100-member limit is checked under the same lock. A
company sign-in limited to its organization by `companySignInLimit`
joins nothing else, and organizations the installation disables stay
hidden.
- **Reserving new organizations.** An organization that verified a
domain by DNS can turn on "Reserve new organizations for
administrators". People on that domain who are not its owners or admins
can then neither create organizations nor open another organization to
the domain. Existing organizations and their join domains continue
unchanged.
- **Storage.** `organization_settings` gains `join_domains` (`jsonb`,
default `[]`) and `restrict_organization_creation` (`boolean`, default
`false`), next to `sso_required` (migration `0038`).
- **API and CLI.** `GET /organizations/joinable`, `POST
/organizations/{organizationId}/join`, `GET /settings/domain-access`,
`POST /settings/join-domains`, `DELETE /settings/join-domains/{domain}`,
`PUT /settings/organization-creation` and `allowDomainJoin` on `POST
/organizations`. The CLI adds `organizations joinable`, `organizations
join ID`, `organizations create --allow-domain-join` and `settings
domain-access`, `add-join-domain`, `remove-join-domain` and
`restrict-organization-creation`.
- **Organization chooser.** The chooser uses the sign-in page's card: 44
px fields, dark primary buttons and a footer strip for signing out.
Creating asks for a name and a URL; the URL shows the installation's
host and follows the name until it is edited. Subtitles that repeated
the heading are gone.
- Only installations with self-service organization creation expose
joining; elsewhere the endpoints return `403` and the settings section
stays hidden.

## Screenshots

Synthetic fixtures, rendered from `main` and this branch.

### A new colleague joins

| View | Before | After |
| --- | --- | --- |
| 1280 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-chooser-newcomer-1280-light.png"
width="420"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-newcomer-1280-light.png"
width="420"> |
| 1280 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-chooser-newcomer-1280-dark.png"
width="420"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-newcomer-1280-dark.png"
width="420"> |
| 390 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-chooser-newcomer-390-light.png"
width="240"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-newcomer-390-light.png"
width="240"> |
| 390 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-chooser-newcomer-390-dark.png"
width="240"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-newcomer-390-dark.png"
width="240"> |

### The domain is verified by DNS for company SSO

| View | After |
| --- | --- |
| 1280 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-verified-1280-light.png"
width="420"> |
| 1280 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-verified-1280-dark.png"
width="420"> |
| 390 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-verified-390-light.png"
width="240"> |
| 390 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-verified-390-dark.png"
width="240"> |

### Creating an organization with a Google Workspace sign-in

| View | Before | After |
| --- | --- | --- |
| 1280 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-chooser-creator-1280-light.png"
width="420"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-creator-1280-light.png"
width="420"> |
| 1280 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-chooser-creator-1280-dark.png"
width="420"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-creator-1280-dark.png"
width="420"> |
| 390 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-chooser-creator-390-light.png"
width="240"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-creator-390-light.png"
width="240"> |
| 390 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-chooser-creator-390-dark.png"
width="240"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-creator-390-dark.png"
width="240"> |

### Creating an organization from the join view

| View | After |
| --- | --- |
| 1280 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-create-from-join-1280-light.png"
width="420"> |
| 1280 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-create-from-join-1280-dark.png"
width="420"> |
| 390 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-create-from-join-390-light.png"
width="240"> |
| 390 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-create-from-join-390-dark.png"
width="240"> |

### Choosing among existing organizations

| View | After |
| --- | --- |
| 1280 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-member-1280-light.png"
width="420"> |
| 1280 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-member-1280-dark.png"
width="420"> |
| 390 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-member-390-light.png"
width="240"> |
| 390 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-chooser-member-390-dark.png"
width="240"> |

### Members settings

| View | Before | After |
| --- | --- | --- |
| 1280 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-members-1280-light.png"
width="420"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-members-1280-light.png"
width="420"> |
| 1280 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-members-1280-dark.png"
width="420"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-members-1280-dark.png"
width="420"> |
| 390 px, light | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-members-390-light.png"
width="240"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-members-390-light.png"
width="240"> |
| 390 px, dark | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/before-members-390-dark.png"
width="240"> | <img
src="https://gist.githubusercontent.com/tnkuehne/83460012bea405cd20e87a085dc939c3/raw/d65d6365da6f2b9fcac116b43be293da2f03e0c7/after-members-390-dark.png"
width="240"> |

Checked: joining, creating with and without the domain switch, the
verified mark, the way back from the create form, choosing an existing
organization and the Members section, each at 390 and 1280 px in light
and dark.

Not checked visually: the chooser for people who already have
organizations and also see joinable ones under "Open to example.com",
the error feedback in the Members section, and the message shown to
blocked creators.

## Validation

- `provider-email-domain.test.ts`: Google `hd` match, mismatch, missing
and unverified email, a Gmail-style account, Microsoft work tenant with
`true` and `"1"`, consumer tenant with `"1"`, `xms_edov` false, missing
and other values, missing tenant, malformed tokens and other providers.
- `domain-access.integration.test.ts`: creation with and without proof
(email code only, consumer tenant, personal Google account, unverified
address), joining (allowed, other domain, unverified email, external
guest in a company sign-in, disabled organization, member limit),
colleague names and the Verified label, administrator settings through
the API (unproven and foreign domains, member access, reservation
without verified domain, removal keeping members) and the creation
reservation (blocked creators, blocked domain opening, administrators of
the reserving organization, existing join domains kept).
- `domain-access-migration.integration.test.ts`: existing settings rows
receive the closed defaults.
- `cli.test.ts`: the new CLI commands and request bodies against the
synthetic API.
- New browser test `domain-join.spec.ts`: a colleague joins by email
code, an administrator removes and restores the join domain, and a
creator opens a new organization to the domain.
- Full Vitest suite: 1266 passed. Browser suites `auth`, `onboarding`,
`public-onboarding`, `oidc`, `organization-writes`, `self-hosted-sso`,
`setup` and `domain-join`: all passed. `cargo clippy` and `cargo test -p
platform-cli` pass. Control-plane typecheck, format and type-aware lint
are clean.
- Not verified with a real tenant: whether Microsoft sends `xms_edov`
for a Gmail guest in a work tenant. The browser and integration tests
use synthetic ID tokens.

Documentation: #301 (draft, waits for a release that includes this
change).




<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><a
href="https://app.greptile.com/api/retrigger?id=115796857&amp;sig=e4317a3406bdcac13753cdc7dd78637333e0c8abbbbded0263c44fad4da17a03"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/-/switch-tenant?tenant=mendra&amp;next=%2Fwidefleet%2Fwidefleet%2Fpull%2F300&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>

<!-- greptile-impact-verdict --> The PR appears safe to merge; no new
blocking issues were found.

<details open><summary><h3>Summary</h3></summary>

Adds joining organizations by verified email domain, administrator
controls, creation restrictions, and API and CLI commands.

- People with a verified company email can join organizations that open
access to their domain.
- Organization admins can manage which company domains may join and
reserve new organizations.
- Organization creators can open their new organization to colleagues on
their company domain.
</details>

<!-- greptile_confidence_score:5 -->

<sub>Reviews (7) · Last reviewed commit: ["Return to the organization
choices
after..."](8a67c2b)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
Base automatically changed from domain-join to main November 23, 2026 09:21
Members can join organizations that are open to their company email
domain from the organization chooser or the CLI. Administrators open
an organization to the domain their Google Workspace or Microsoft work
sign-in proves, and organizations with a verified company domain can
reserve new organizations on it for their administrators.

The API and CLI references describe the new endpoints, the
allowDomainJoin creation field and the new commands.
@jonathanlaib jonathanlaib added the documentation Improvements or additions to documentation label Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants