# SSO and SCIM

> Verified email domains with auto-join and SSO enforcement, SAML providers per organization registered with Supabase Auth, and SCIM 2.0 users and groups that provision memberships and map groups to roles.

- Category: Identity & access
- Module: `sso`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/sso
- Page: https://bettersupabase.com/blocks/sso

## Install

```bash
npx better-supabase add sso
```

The command also installs `updated-at`, `memberships`, `permissions`.

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Required by sso; add installs them too.
    "updated-at": {},
    memberships: {},
    permissions: {},
    // Modes: "managed", "custom". The default is "managed".
    sso: { mode: "managed" },
  },
});
```

## Client

The block has no React entry yet. Its server-side TypeScript is in `better-supabase/blocks/sso`.

## Events

- `organization.member_added`
- `organization.member_removed`
- `organization.role_changed`
- `scim_group.created`
- `scim_group.deleted`
- `scim_group.updated`
- `scim_user.created`
- `scim_user.deleted`
- `scim_user.updated`
- `sso_domain.created`
- `sso_domain.deleted`
- `sso_domain.updated`
- `sso_domain.verified`
- `sso_provider.registered`
- `sso_provider.unregistered`

## Related blocks

Requires: [memberships](https://bettersupabase.com/blocks/memberships.md), [permissions](https://bettersupabase.com/blocks/permissions.md)

Works with: [organizations](https://bettersupabase.com/blocks/organizations.md), [data-lifecycle](https://bettersupabase.com/blocks/data-lifecycle.md)

## Recipes

- [SSO connection settings](https://bettersupabase.com/recipes/sso-settings.md): The organization's SAML or OIDC connection with its domains and the role new members get.
