Skip to main content

Recipes

One feature in a few files, in each SDK that supports it. Copy a recipe into an app that you already have.

A recipe answers one question, for example "how does an agent ask a person for approval?". It lists what to set up in LumoAuth, shows the code in each language, and says how to check the result.

Each language of a recipe says how far it was checked: run against a LumoAuth organization, compiled only, or not run.

133 of 133
Act for a person, with consent

A person allows an agent to act for them. The agent then holds a token that names both: the person as subject, the agent as actor.

JavaScript / TypeScriptPythonGoPHP+2
Ask a person for a permission, for one task

An agent that lacks a permission asks for it with a reason. A person approves, and the agent gets a token for that task only.

JavaScript / TypeScriptPythonGoPHP+3
Ask before acting

Before each action, the agent asks LumoAuth whether it may do it, and receives the answer with the reason.

JavaScript / TypeScriptPythonGoJava+2
Check a permissionDraft

Ask LumoAuth whether a person may do something, from each server SDK and from plain HTTP.

JavaScript / TypeScriptPythonGoPHP+3
Connect Claude Code, Cursor or VS CodeDraft

Point a coding agent at your protected MCP server. It finds LumoAuth, signs the person in, and calls the tools.

MCP clients
Guard an OpenClaw agent

Install LumoAuth Guard in OpenClaw. Each tool call is checked against what you allowed, and risky ones ask you first.

OpenClaw
LangChain and LangGraphDraft

A LangGraph agent whose tools ask LumoAuth before they run, and a payment that waits in an interrupt until a person approves it.

LangChain / LangGraphPython
One organization for each customer

Give each business customer its own members, roles and invitations inside your product.

ExpressPlain HTTPJavaScript / TypeScriptlumo CLI
Receive webhooksDraft

Handle events from LumoAuth in your backend: verify the signature, answer fast, and survive a repeat.

ExpressFastAPIGo net/httpJavaScript / TypeScript+3
Register an agent

Give an agent its own identity in the registry, choose how it proves that identity, and say what it may do.

lumo CLIPlain HTTP
Register an MCP server

Tell LumoAuth about your MCP server: its address, its scopes and who may connect. Then read what a client reads.

lumo CLIPlain HTTP
Service-to-service calls

Give a backend service its own identity, get a token with the scopes of one job, and call another service.

JavaScript / TypeScriptPythonGoPlain HTTP
Sign in through the hosted page

Send the browser to your organization's sign-in page and come back with tokens. The app never sees a password.

ReactVueAngularJavaScript / TypeScript
Sign out of every applicationDraft

End the session at LumoAuth, and tell the other applications of that session to sign the person out.

ExpressFastAPIJavaScript / TypeScriptPython
An agent calls an MCP tool

An agent gets a token for one MCP server and calls a tool. The token works at that server only.

JavaScript / TypeScriptPythonGoJava+1
An agent gets its first token

Start an agent with a client ID and secret, get a token with its capabilities, and read its own identity.

JavaScript / TypeScriptPythonGoJava+1
Approve routine requests by rule

Let a rule approve the requests that are always fine, so that people see only the ones that need a decision.

Plain HTTP
Check capabilities without a network call

Decide inside the agent, from the list of its capabilities, with the same matching rules as the server.

PythonGoJavaC# / .NET+1
CrewAIDraft

A crew in which each member is its own registered agent with its own capabilities, and a refund that waits for a person.

CrewAIPython
Guard a Hermes agent

Install LumoAuth Guard in Hermes, with the same presets and the same checks as for OpenClaw.

Hermes
Hand work to a sub-agent

An agent passes part of a task to another agent, with fewer scopes, and the token records the whole chain.

JavaScript / TypeScriptPythonGoJava+1
Let customers manage their own membersDraft

Give the administrators of a customer a portal in which they invite people and assign roles, with no work for your team.

Plain HTTP
List and end sessions

Show the active sessions of a person, and end one of them or all of them.

lumo CLIPlain HTTP
Protect a FastMCP server

Add LumoAuth to a FastMCP server in three lines: discovery, the 401 challenge and token checks.

FastMCPPython
Protect routes in each frameworkDraft

Refuse a request before the handler runs, with the idiom of each framework: middleware, a dependency, an attribute or an annotation.

ExpressNext.jsFastAPIGo net/http+11
Query and export the audit log

Find who did what, and export a period as CSV or JSON for a review.

lumo CLIPlain HTTP
Sign in with a form in your app

Send an email and a password that your own form collected to LumoAuth. This is the legacy option, for apps that are not a browser page.

JavaScript / TypeScriptPlain HTTP
Verify access tokens in your API

Check a token inside your service with the published keys: signature, issuer, audience, expiry and scopes.

ExpressFastAPIGo net/httpJavaScript / TypeScript+2
An agent that signs in with a key

Give an agent a private key in place of a secret. Nothing that can be copied out of a log is sent.

JavaScript / TypeScriptPythonGo
Ask the person on their phoneDraft

Before a risky action, the agent sends an approval request to the phone of the person it acts for, and waits for the answer.

JavaScript / TypeScriptPythonGoPHP+2
103 not shown

Run a recipe​

Every recipe is a folder in recipes/ of the examples repository. You run each one from that folder.

git clone https://github.com/LumoAuth/examples
cd examples/recipes

1. Set the three values​

Every recipe reads the address of LumoAuth, your organization and a credential from the environment. The SDKs read the same names, so the code needs no settings of its own.

export LUMOAUTH_URL="https://app.lumoauth.dev" # or https://eu.app.lumoauth.dev
export LUMOAUTH_ORG_ID="acme-corp" # your organization
export LUMOAUTH_API_KEY="lmk_..." # an API key: portal, Applications & developer tools, API keys

A recipe that needs more values lists them under "Before you start". Most recipes have a setup script that creates what the recipe needs and prints those values.

2. Set the folder up once for your language​

Node.js 20 or later.

npm install

3. Run it​

Each recipe shows its command. For example:

node authorization/check-a-permission/setup.mjs
node authorization/check-a-permission/js/check.mjs