Hosted pages on your domain
Sign in, sign up, reset, invites, consent and an account page, with your branding, on microauth.dev or your own subdomain.
User authentication and AI access
MicroAuth gives your app hosted sign in on your own domain, OAuth 2.1 and OpenID Connect, roles and permissions, and MCP authorization, so people can connect AI assistants to your tools with only the access they approve. Built for FastAPI, on open standards.
Selling an API instead? Keys, rate limits and billing are here too.
from fastapi import Depends, FastAPI
from microauth_fastapi import User, UserAuth
app = FastAPI()
auth = UserAuth(app) # adds /auth/login, /auth/callback and /auth/logout
@app.get("/dashboard")
async def dashboard(user: User = Depends(auth.login_required)):
return {"hello": user.name}
@app.post("/posts")
async def create_post(user: User = Depends(auth.require(permissions="posts:write"))):
...
from fastapi import Depends, FastAPI
from microauth_fastapi import TokenAuth, TokenClaims
app = FastAPI()
api = TokenAuth(app) # reads MICROAUTH_ISSUER and MICROAUTH_RESOURCE
@app.get("/posts")
async def posts(token: TokenClaims = Depends(api.require("posts:read"))):
return {"user": token.sub, "app": token.client_id}
from fastapi import FastAPI
from mcp.server.mcpserver import MCPServer
from microauth_fastapi import McpAuth, current_identity
mcp = MCPServer("Invoices", log_level="WARNING")
auth = McpAuth(scopes=["invoices:read"])
@mcp.tool()
@auth.tool("invoices:write")
def create_invoice(customer: str, amount_cents: int) -> dict:
return {"owner": current_identity().sub, "customer": customer, "amount_cents": amount_cents}
app = FastAPI()
auth.mount(app, mcp) # serves /mcp next to your other routes
How it works
Create a sign in service in the dashboard, register your app, and add the SDK. MicroAuth runs the pages, the accounts and the OAuth server.
Sign in, sign up, password resets, invites, passkeys and two step verification, with your logo and colors. They are live at yourapp.microauth.dev right away, and can move to a domain of yours like auth.example.com.
People also get an account page for their profile and photo, sessions, connected providers and the apps they allowed.
Every app uses the code flow with PKCE. Access tokens are short lived JWTs for one API, refresh tokens change on every use, and ID tokens tell your app who signed in and how.
Web apps, single page apps and native apps all work, with any OpenID Connect library. With FastAPI, the SDK does it in a few lines.
{
"issuer": "https://auth.example.com",
"authorization_endpoint": "https://auth.example.com/oauth/authorize",
"token_endpoint": "https://auth.example.com/oauth/token",
"jwks_uri": "https://auth.example.com/oauth/jwks",
"code_challenge_methods_supported": ["S256"],
"scopes_supported": ["openid", "profile", "email",
"offline_access", "roles", "posts:read", "posts:write"]
}
Define permissions such as posts:write and group them into roles. Your app reads them from the session, and they become the OAuth scopes of your APIs and MCP servers.
The users page lets you search, change roles, see sessions and connected apps, suspend someone, sign them out everywhere, send a password reset or invite new people.
AI access with MCP
MicroAuth is the authorization server for your MCP server, following the MCP authorization spec. You keep your tools and your data. MicroAuth handles sign in, consent and tokens.
Your MCP server answers with its metadata, which names your sign in service and the scopes to ask for.
They sign in on your pages and see the app, where it sends them back and each permission it wants.
The client gets a short lived token that only your MCP server accepts, with only what the person holds and allowed.
The SDK checks the token and the scopes each tool needs. Your code still decides which records the person can touch.
When a tool needs more, the client asks again for just the new permissions, which join the existing grant.
People see every app they allowed and disconnect any of them. You can block an app for everyone.
AI clients use Client ID Metadata Documents, and older ones can register themselves. Each one is labeled on the consent screen.
A client that can't do OAuth can use an API key the person creates, limited to the permissions they choose.
$ curl -X POST https://app.example.com/mcp
401WWW-Authenticate: Bearer resource_metadata="https://app.example.com/.well-known/oauth-protected-resource/mcp", scope="invoices:read"
# a token holding invoices:read calls list_invoices
200{"result":{"content":[...]}}
# the same token calls create_invoice
403WWW-Authenticate: Bearer error="insufficient_scope", scope="invoices:read invoices:write"
Features
Sign in, sign up, reset, invites, consent and an account page, with your branding, on microauth.dev or your own subdomain.
Discovery, PKCE for every app, pushed authorization requests, rotating refresh tokens, userinfo, revocation, introspection and sign out.
Permissions you name, roles that bundle them, and default roles for new users. Changes reach your app within one token lifetime.
Search users, change roles, suspend, sign out everywhere, send a reset, remove two step verification, delete or invite.
Google, GitHub, any OpenID Connect provider or a generic OAuth 2.0 one, with your own client credentials and safe account linking.
Protected resource metadata, consent, step up, connected apps and per tool scopes for the MCP servers your users connect AI clients to.
People create keys for scripts and CI with the permissions they choose. Your API checks them with standard token introspection.
Passkeys, authenticator apps and recovery codes on your sign in pages, with security emails under your app's name.
UserAuth for web apps, TokenAuth for APIs and McpAuth for MCP servers, in one package.
APIs
The same workspace runs API services: keys, rate limits and usage billing that your API checks itself. Your traffic never goes through MicroAuth.
Developers sign up on a portal with your name on it, create keys and pay you through your own Stripe account.
For an API your own teams or partners call. You invite who gets in and issue their keys, and nobody pays.
from fastapi import FastAPI, Security
from microauth_fastapi import MicroAuth, Customer
app = FastAPI()
auth = MicroAuth(app) # reads MICROAUTH_SECRET_KEY
@app.get("/forecast")
async def forecast(customer: Customer = Security(auth)):
return {"hello": customer.id}
/sdk/v1/snapshotCache customers, keys and limits locally/sdk/v1/keys/verifyLook up a key created seconds ago/sdk/v1/usageReport usage in idempotent batchesQuestions
No. Sign in is standard OpenID Connect, so any OpenID Connect library works, in any language. Access tokens are JWTs your API can check with the published signing keys, and API keys can be checked with standard token introspection. FastAPI gets an SDK that does all of it in a few lines.
Sign in does: the sign in pages and the OAuth endpoints run on MicroAuth. After that, your app, APIs and MCP servers check tokens themselves with your service's signing keys, so their requests never pass through us. For API services, the SDK checks keys from a cached copy and only sends usage counts.
The sign in pages keep their own session on your sign in domain, which gives single sign on across your apps. Each app runs the code flow on its server, and the FastAPI SDK keeps its session in an encrypted, HttpOnly cookie. No token is ever handed to browser JavaScript.
Clients that follow the MCP authorization spec. They identify themselves with a Client ID Metadata Document, or register themselves when they are older. Apps people connect are turned on per service, on the plans that include them. Read how it works.
Yes, with your own client credentials from Google or GitHub. You can also add any OpenID Connect provider, or a generic OAuth 2.0 one. The pricing page shows which plans include each.
No. MicroAuth isn't a gateway or a proxy. The SDK inside your API caches customer limits and reports usage counts in batches. Request bodies, headers, query parameters and responses never leave your servers.
Create a sign in service in the dashboard, register your app and add a few lines with the FastAPI SDK. Your sign in pages are live right away.