Node and FastAPI resource servers
Make authorization decisions where your data lives. A hidden button is never an access control.
Verify the intended resource
Pin the issuer and your API's registered resource URI. Verify the signed token before reading its claims. Apply the owning application's tenant and permission rules after central identity verification.
Node · typescript
import { createVerifier } from "@beyondigital/auth-sdk";
const verifier = createVerifier({
issuerUrl: "https://auth.example.com",
audience: "https://api.example.com"
});
const user = await verifier.verify(accessToken);
if (!user.hasScope("documents:read")) {
throw Object.assign(new Error("Forbidden"), { statusCode: 403 });
}
// Map this error to HTTP 403 in your framework error handler.
// Also enforce your application tenant/membership policy.Python / FastAPI · python
from typing import Annotated
from fastapi import Depends, FastAPI
from beyondigital_auth import CurrentUser, create_verifier
from beyondigital_auth.middleware import make_auth_dependency
verifier = create_verifier(issuer_url="https://auth.example.com",
audience="https://api.example.com")
current_user = make_auth_dependency(verifier)
app = FastAPI()
@app.get("/me")
async def me(user: Annotated[CurrentUser, Depends(current_user)]):
return {"subject": user.id}Run the repository examples
The SDK source directories include a Node HTTP server example and a Python FastAPI app factory. Their automated tests exercise a signed synthetic access token, anonymous refusal and missing-permission refusal. Install the Python fastapi extra for its framework adapters. Python 3.12 and Node 20+ are the currently declared SDK runtimes.
JWKS validation accepts a locally valid token until expiry. Use authenticated, audience-bound introspection when an operation needs live session or revocation state.