FoxAuth OAuth 2.1 & OIDC Documentation
FoxAuth is built on OAuth-server.ts, a source-available OAuth 2.1 and OpenID Connect authorization server. You can run it yourself, or use it free on FoxAuth Cloud. This documentation covers three jobs: getting a server running, connecting an application to it, and operating it once real users depend on it. Pick the one you are doing now.
Not sure what you need? Answer two questions about your app, or about what your customer’s company asks for. The guide shows which setup fits, what happens step by step, and the one button that sets it up.
Getting a server running
Section titled “Getting a server running”Start with Run with Docker Compose. One command starts MongoDB, provisions the schema and serves the authorization server, which is probably the fastest way to see a working instance. If you would rather work against the source, Run from source clones the repository and starts the server with Bun.
Either way the next step is Create the first administrator: a fresh database has no accounts, and the one-time setup screen creates the first one. Turn on the second factor there before anything else.
To skip running a server, create a free account on FoxAuth Cloud, our
instance at auth.foxauth.dev. You get a personal team and up to ten projects, free during the beta with every
feature and no limit on users. The Get started pages assume a server at
http://localhost:3000: on the cloud, replace it with your project’s issuer URL, shown on the project’s Overview.
Connecting an application
Section titled “Connecting an application”An application talks to the server as an OAuth client, and a client has to exist before it can ask for a token. Register your first client covers the pieces that trip people up: the difference between a public and a confidential client, why redirect URIs are matched exactly and never by pattern, and which project a client signs people in from.
Then Get your first token walks the Authorization Code flow with
PKCE (Proof Key for Code Exchange) end to end using curl, from the code challenge to a decoded ID token and a UserInfo call.
By default PKCE is mandatory for every client, not only public ones. OAuth 2.1 requires it, and in our experience
the requirement is the most common surprise for anyone arriving from an OAuth 2.0 server.
If the application you are connecting is an MCP server, it is not an OAuth client but a protected resource, and the shape is different enough to have its own page: Protect your MCP server with OAuth declares the MCP server on this authorization server, publishes the two things an MCP server has to publish, validates a token, and shows both a refusal and a success.
Running the server in production
Section titled “Running the server in production”Deploy covers three targets: Fly.io,
Kubernetes, Docker Compose on a single
host. The database is MongoDB or
PostgreSQL, and the connection string you set picks between
them. Whichever you choose, read Behind a reverse proxy. The
issuer URL must be an https:// address and must match what clients were configured with. A proxy
that rewrites headers without being told to is the usual cause of tokens that validate locally and
fail in production.
Read Upgrading before you move between versions. Since 1.0.0, the HTTP surface and
the admin API change incompatibly only in a major release, and the changelog says what moved. After an upgrade, re-run the setup script so new collections
and indexes exist, then run bun run db:migrate for anything a release has to reshape.
Administering projects once users sign in
Section titled “Administering projects once users sign in”Once people sign in through the server, the work moves to the console. Connect an upstream identity provider lets a project’s users sign in through Google, Microsoft, Apple, GitHub or any OpenID provider, and decides which accounts such a sign-in may create or link. Once a provider is connected, Provision users from Entra ID or Okta hands the project’s users and groups to the directory over SCIM, and Sign-out from upstream providers lets a sign-out at the upstream provider end the user’s sessions on this server.
Teams and project ownership covers the administrator teams that own projects and moving a project between them. Project addresses compares the three addresses a project can have, a path, a subdomain or a hostname of its own, and what the subdomain form needs from the operator. Groups and the groups claim covers the groups of end users a relying party reads in place of roles. End a user’s access compares deactivation, the lock, signing out everywhere and deletion, and names the one token none of them can recall. Rotate signing keys rotates the instance’s and each project’s keys in one step without a restart, and revokes a compromised key at once. Plans and Free-tier limits is for a public instance where anyone may register as an administrator: a plan limits what each team may create, and pauses new sign-ups at a project’s monthly active-user cap. Connected services let a project’s users connect their own accounts at Google, GitHub, Slack, Microsoft or another OAuth provider. The server stores those tokens encrypted. An agent obtains a person’s token only when an administrator and that person have both allowed it. When something is missing, the agent gets a link to hand the person, which leads them straight to connecting or allowing.
Deciding whether to trust the server
Section titled “Deciding whether to trust the server”An authorization server is the front door of everything behind it. Before you put one in front of real users you are entitled to ask what it defends against and how anyone knows. The threat model answers the first question: the assets, the attackers, and for each threat the control in the code and the test that holds it, along with the limitations that are true today. Security assurance answers the second: the scanning that runs on every push and every week, where each result is published, and what has not been done yet. Reporting a vulnerability is covered by the security policy.
Reference pages generated from the source
Section titled “Reference pages generated from the source”The Reference section is generated from the server’s own source on every build, so it describes the release the site was built from; nothing in it is maintained by hand:
- Settings: every server-wide flag and option, what it does, and whether changing it needs a restart.
- Endpoints: every route the server serves, which feature flag governs it, and its CORS and rate-limit class.
- Admin API: the management API behind the console.
- MCP tools: the operations an AI agent may perform, an allow-list chosen on purpose and narrower than the whole admin surface.
- Addon seams: the named functions you replace with your own instead of forking.
- Environment variables: what has to be set before the server will start.
What the server does not support
Section titled “What the server does not support”The server speaks OAuth 2.1 and OpenID Connect, and nothing else. There is no SAML support and none planned. The Implicit and Resource Owner Password Credentials grants are not implemented, because OAuth 2.1 removes them. If an application depends on either, it needs changing before it can use this server.
If you are still deciding whether to run it at all, the comparisons put it beside the servers teams usually weigh it against, with the date each claim was checked.