# Single sign-on (SSO)

Single sign-on is an authentication setup in which one account and its authenticators give a person access to several applications, usually through a federation protocol such as OpenID Connect or SAML. For an internal tool it means people sign in with the company account they already have, and leavers lose access when IT closes that account; Meadowstack 2.1 leaves the identity provider to you and keeps one file to swap.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/glossary/single-sign-on/

*The starter's sign-in says what it is: a development stub, and which providers replace it.*

From `templates/starter/src/auth/auth.tsx` in the Meadowstack repository:

```ts
* Sign-in, as a stub for development. It is not security: any password works
* for the people in users.ts, and the session is a person's id in
* sessionStorage (it ends when the tab closes).
*
* Replace it before the app goes live with your client's identity provider:
* Microsoft Entra ID or Google Workspace for a company's own staff (single
* sign-on, their groups mapped onto the roles in workspace/core.tsx), or
* Auth.js or Supabase Auth when the app keeps its own accounts. Keep the
* shape of this file (AuthProvider, useAuth, RequireAuth, a Person with a
* role) and the rest of the app does not change. docs/security.md has the
* steps.
```

## Why it matters in a business app

An internal tool with its own passwords is one more account to forget, reset and, worst of all, leave open after someone goes. With SSO the company's identity provider (Microsoft Entra ID, Google Workspace or another) signs people in, applies its multi-factor rules, and switches the account off on the last day for every app at once.

It also gives the app trustworthy groups: "finance" in the directory can become the approver role in the app, so roles follow the org chart instead of a spreadsheet.

## How Meadowstack handles it

Truthfully, in 2.1:

- **The starter signs in with a stub for development.** Any password works for the seeded people and the session is a person's id in `sessionStorage`. It is not authentication, and the file says so.
- **One file to replace.** Keep the shape of `src/auth/auth.tsx` (`AuthProvider`, `useAuth`, `RequireAuth`, a person with a role) and the rest of the app does not change. Map the provider's groups onto the roles in `workspace/core.tsx`.
- **Tokens to the api.** `setAccessTokenSource()` in `shared/http.ts` hands the provider's token to every call; the server takes the person from it ([OpenID Connect](https://meadowstack.com/glossary/openid-connect/)).
- **The rest is the provider's.** `docs/security.md`: multi-factor sign-in, password rules and lockout belong to the identity provider; sign-out ends the session on the server too; remove the stub, the person switcher and the seeded people before go-live.

Meadowstack 3.0, coming as an update to every licence, brings its own sign-in (magic link or password, TOTP and passkeys). SSO with a company directory stays a connection you configure.

## Common mistakes

- **Shipping the stub.** Search the project for it before go-live; the security checklist starts there.
- **Roles from the browser.** The role comes from your data or the provider's claims, checked on the server, never from a field the page sends.
- **The token in localStorage.** Any script on the page can read it; prefer HttpOnly cookies or the provider's library.
- **SSO without sign-out.** Ending the local session but not the server's leaves a working token behind.

## Questions

### Does Meadowstack include single sign-on?

Not in 2.1. The starter has a development stub and one file to replace with your identity provider; the docs list Microsoft Entra ID, Google Workspace, Auth.js and Supabase Auth as typical choices.

### Is SSO the same as multi-factor authentication?

No. SSO means one account for many apps; multi-factor means more than one proof at sign-in. A good identity provider does both, and SSO lets every app inherit its multi-factor rules.

### Which protocol should an internal tool use for SSO?

OpenID Connect for a new web app, since it is built on OAuth 2.0 and every major identity provider offers it. SAML is still common in older enterprise setups.

## Sources

- [NIST CSRC Glossary, single sign-on (from SP 800-63-4)](https://csrc.nist.gov/glossary/term/single_sign_on), checked 2 December 2026
- [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html), checked 2 December 2026

## Related

- [Google Workspace: only your company's domain](https://meadowstack.com/integrations/google-workspace/) (Integrations)
- [Microsoft Entra ID: the person from the token](https://meadowstack.com/integrations/microsoft-entra-id/) (Integrations)
- [Supabase: the rules in the database](https://meadowstack.com/integrations/supabase/) (Integrations)
- [OpenID Connect (OIDC)](https://meadowstack.com/glossary/openid-connect/) (Glossary)
- [RBAC (role-based access control)](https://meadowstack.com/glossary/rbac/) (Glossary)
- [Permissions checklist for apps built with AI](https://meadowstack.com/tools/permissions-checklist/) (Tools)
