Identity & Access
One env var and five endpoints separate a scaffolded workspace from a working OAuth sign-in — and the boundaries fail loud with typed errors instead of degrading to a silent anonymous session.
Identity & Access covers the Principal model, authentication backends, sessions, roles, scopes, and claims. Use this pillar when you are adding sign-in, selecting a backend, or reasoning about how identity flows through services and pages.
Auth is where an agent-assembled backend most easily looks done without being done — the
mis-wired flow compiles, demos, and ships. NetScript's answer is to keep the security conventions
in the contract itself: NETSCRIPT_AUTH_BACKEND selects exactly one active backend, every backend
normalizes to the same Principal, unsupported operations fail loud with typed errors, and the
redacted audit surface refuses to run without a salt. The full story — including the concrete
failure modes the contract closes off — is on the
Authentication page.
The auth plugin story: one active backend, five endpoints, fail-loud typed boundaries, and the salt-gated audit surface.
Overview & Concepts Auth modelPrincipal, session, backend, and authorization vocabulary.
Quickstart Workspace authAdd authentication in the Workspace tutorial.
How-To Add authenticationWire authentication into a generated workspace.
How-To better-auth pluginsMount better-auth plugins through a typed passthrough; bearer and jwt run as-is, table-backed and interactive plugins carry caveats.
How-To Session lifecyclesMount public handlers, redirect, handle callbacks, check return URLs, and forward refresh headers across adapters.
API Reference auth backendsGenerated symbols for auth, better-auth, kv-oauth, and WorkOS packages.
API Reference plugin authGenerated plugin-auth package symbols.
Learn, do, look up
Auth, workspace data, and route authorization in one track.
Do RecipesTask-oriented recipes for this area, one problem each.
Look up `@netscript/auth` referenceGenerated API reference. Related units: `auth-better-auth`, `auth-kv-oauth`, `auth-workos`, `plugin-auth`.
Understand The auth modelThe design rationale behind this pillar.