Organization Login
Organization login lets a user sign in to one of their organizations rather than to your app as a whole. The hosted login page shows the organization’s name and logo and only its connections, AuthAction checks that the user is a member, and the tokens say which organization the session is for.
Turn it on for an application
Section titled “Turn it on for an application”In the dashboard, open the application and find Authentication policy > Organizations:
| Setting | What happens |
|---|---|
| Off | The default. An organization parameter on the authorize request is refused. |
| Optional | The authorize request may name an organization. Without one, the user signs in for themselves and the tokens carry no organization. |
| Required | Every login ends in an organization. A member of one goes straight in; a member of several chooses on a picker; a member of none is turned away. |
With the Management API, set organizationUsage to none, optional or
required on PATCH /api/v1/applications/{id}.
Sign in to an organization
Section titled “Sign in to an organization”Add organization to the authorize request, with the organization’s name or id:
const { loginWithRedirect } = useAuthAction();
loginWithRedirect({ authorizationParams: { organization: "acme" } });GET https://<tenant-domain>/oauth2/authorize ?client_id=<client id> &redirect_uri=https://app.example.com/callback &response_type=code &code_challenge=<S256 challenge> &code_challenge_method=S256 &organization=acmeThe login page then shows the organization’s display name and logo. If the organization has exactly one social or enterprise connection, the login page is skipped and the user goes straight to that identity provider.
An unknown organization, or one sent for an application with organizations turned off, shows an error page.
Membership
Section titled “Membership”Only members get a code. A user who signs in but isn’t a member is sent back to your redirect URI with:
?error=access_denied&error_description=The user is not a member of the organization&state=...Add members on the organization’s Members tab or with
POST /api/v1/organizations/{id}/members.
Join automatically
Section titled “Join automatically”On the organization’s Login tab, Join automatically makes a user a member when they sign in to the organization:
- through one of the organization’s connections, or
- with a verified email address at one of its domains.
An unverified address never qualifies.
Connections and email domains
Section titled “Connections and email domains”The organization’s Login tab also sets:
- Connections: the ways members sign in to this organization, usually its SAML or Google Workspace connection. Only connections also enabled for the application are offered. Leave it empty to use the application’s connections.
- Email domains: on the login page, an address at one of these domains
goes straight to the organization’s connection, so
alice@acme.comsigns in with Acme’s identity provider without choosing it. This needs the application’s Organizations setting to be Optional or Required. A domain can belong to one organization. - Logo URL: shown on the login page in place of the tenant’s logo.
With the Management API:
PATCH /api/v1/organizations/{id}Content-Type: application/json
{ "domains": ["acme.com"], "connections": ["<connection id>"], "autoMembership": true, "logoUrl": "https://cdn.acme.com/logo.svg"}The organization picker
Section titled “The organization picker”When the application requires an organization and the request doesn’t name one, a user who belongs to several chooses on a picker after signing in. The picker lists only their own organizations.
Tokens
Section titled “Tokens”A login for an organization adds these claims:
| Claim | Access token | ID token | Value |
|---|---|---|---|
org_id | Yes | Yes | The organization’s id |
org_name | Yes | Yes | The organization’s name, such as acme |
org_roles | Yes | No | The user’s role names in the organization |
Check org_id on your API before acting on an organization’s data. Token
introspection returns the same claims.
Refreshing re-reads them: roles changed since sign-in show up in the new access token, and a user removed from the organization, or an organization deleted, can no longer refresh.
An existing session is reused for another login to the same organization. A
login to an organization the user doesn’t belong to returns access_denied
rather than asking them to sign in again.
Billing
Section titled “Billing”GET /billing/entitlements with an access token issued for an organization
returns that organization’s plan, without ?organization=. See
Entitlements.