Build B2B SaaS auth on .NET

Start with one application and hosted login. Add organizations, SSO, and SQL-backed authorization when your product needs them.

Version contract

These docs target SqlOS 7.1.0, .NET 9, EF Core 9, and SQL Server or PostgreSQL. Use the same package version as the docs; older releases do not include the complete current schema and source/reference contract.

The standard flow: one app, one call#

Almost every SqlOS host is one product. Describe it once and SqlOS derives the routes, token validation, metadata documents, client registration, and seeds:

CSHARP
builder.AddSqlOS<AppDbContext>(
    db => db.UseSqlServer(connectionString),
    options => options.UseSingleApplication("Acme", app =>
    {
        app.Origin = "https://acme.example.com";
        app.Api = "/api";                                     // resource id {Origin}/api
        app.Mcp = "/mcp";                                      // resource id {Origin}/mcp
        app.Brand(page => page.PrimaryColor = "#0f172a");     // hosted sign-in, or app.Headless("/auth/authorize") for your own UI
        app.Authorization(fga => /* resource types, permissions, roles */ fga);
    }));

The normal path is incremental:

  1. Declare one application with Origin; hosted login and the dashboard work immediately.
  2. Complete hosted login into your ASP.NET Core session.
  3. Add Api to protect your application API.
  4. Add Authorization only to data that needs fine-grained rules.
  5. Add Brand or Headless, an Mcp server, social login, SAML SSO, MFA, and audit as requirements appear.

Second shape: many applications#

When other applications should sign in with your accounts — another browser app, a CLI alongside it, or a partner using "Sign in with Acme" — use ConfigureApplication with explicit client registrations. A separate frontend and API can still be one client application. Start there only when a second application exists.

The sidebar is grouped by product capability: host, sign-in, tokens, clients, MCP, organizations, directory, authorization, and operations. Start at Getting Started or the runnable examples.

Host

9 pages

The canonical SqlOS setup: describe one application in one AddSqlOS call and let SqlOS derive the protocol consequences.

Browse 9 pages in Host

Clients

5 pages

Choose the right client onboarding path for owned apps, portable clients, and compatibility clients.

Browse 5 pages in Clients

Directory

5 pages

Provision users and groups from an enterprise IdP into AuthServer and FGA.

Browse 5 pages in Directory
ESC

Type to search documentation. Use arrow keys to navigate results.