Core Concepts
Sectors
Section titled “Sectors”A sector is an isolated namespace for users, security settings, OAuth providers, and allowed origins.
Signup creates a tenant root (your root tenant): the organization you administer in the dashboard. Its slug is the dashboard login path (/login/{slug}), and its Sector ID is only for that root. Do not put the signup Sector ID in the login widget.
Create an app sector for each application. The dashboard button is New sub-sector. Put one app sector per application. The tenant root can authenticate an app, but mixing products in the root mixes users, CORS, OAuth clients, and API keys.
Tenant root admins can manage every sector in the organization. App-sector admins only manage that sector. End-user login always targets a single sector ID — use the app sector ID in the login widget. See Tenant root and app sectors.
Key sector properties:
- Sector ID — a UUID. The widget and your app use the app sector ID. The ID from signup is the tenant root.
- Slug — URL identifier for dashboard login (
/login/{slug}); set at create and immutable - Domain — the primary domain for the app that uses this sector (CORS and email links)
- Allowed Origins — additional CORS origins allowed to call the SpartanAuth API
- Self-Sign-Up — whether new users can register themselves, or must be invited
Profiles
Section titled “Profiles”A profile is a user account within a sector. Every profile belongs to exactly one sector.
A profile stores:
sub— a stable UUID identifier for the user (use this as the foreign key in your own database)email/username- Authentication credentials (hashed password, WebAuthn credentials, MFA registrations)
- Basic profile fields (first name, last name, etc.)
When a user logs in successfully, SpartanAuth issues a signed JWT (JSON Web Token). The widget stores it in localStorage under spartan-token.
The JWT payload contains a nested Claims object with these fields:
{ "Claims": { "sub": "3f2a8c1d-...", "email": "user@example.com", "username": "user@example.com", "sectorID": "a1b2c3d4-...", "tid": "2c27e84b-...", "isAdmin": false, "exp": "1717000000", "iat": "1716996400" }}sectorID is the sector the user authenticated against (use this to match the login widget). tid identifies the organization and is present on hosted multi-tenant tokens.
exp is when the token stops working. Each sector sets that lifetime in security settings. The platform default is 4 hours, and the maximum is 7 days. A token already issued keeps the expiry it was given.
Never trust JWT claims for server-side authorization without verification. Always call the introspection endpoint from your backend.
Services
Section titled “Services”A service is one of your own programs, such as an API or a worker. It is not a user. You create it on the app sector, store its secret in that program’s environment, and the program mints a one-hour token to call your other programs in that same app. The secret cannot administer SpartanAuth. See Services.
Transactions
Section titled “Transactions”Multi-step authentication flows (MFA challenges, password reset, sign-up confirmation) are tracked via a transaction. The widget handles transactions internally — your frontend receives a transactionID alongside the final token in the spartan-login event, which you can use for audit logging if needed.
Authentication Methods
Section titled “Authentication Methods”SpartanAuth supports multiple authentication methods per user, all within the same login widget:
| Method | Description |
|---|---|
| Password | Email + password login. Included on every plan. |
| WebAuthn / Passkeys | FIDO2 hardware keys and device biometrics. Included on every plan. Configure the relying party on the app sector your users sign in to. |
| Email code | One-time code or magic link by email. Weaker than a passkey; use it as a convenience. |
| Authenticator app (TOTP) | Six-digit codes from an authenticator app, plus eight one-time recovery codes. When a sector, the platform, or the user requires MFA and the user has no second factor yet, the login widget can enroll an authenticator during sign-in. |
| SMS | Not offered. |
| Social Login | Google, GitHub, Apple via OAuth 2.0 / OIDC |
Users can enroll in multiple methods. The <spartan-account-settings> widget lets authenticated users manage passkeys, email codes, and authenticator apps. Set its sector attribute from the token’s sectorID. show-skeleton="true" holds a placeholder until that first load finishes.