dragonJSON forwards authentication headers on every request — bothDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/michael-tiger-2010/dragonjson/llms.txt
Use this file to discover all available pages before exploring further.
GET reads and POST mutations. Credentials are set once at client initialization and applied automatically for the lifetime of that client instance. On the server side, the Node.js reference implementation uses a tree-shaped authConfig object that maps path prefixes to $auth functions, with the deepest match in the tree taking precedence.
Client-side: Bearer token
Pass aBearer token via the auth option. dragonJSON adds it as an Authorization header on every request:
Client-side: custom headers
For API keys, tenant identifiers, or any other custom header, use theheaders option:
auth and headers can be combined. When both are present, Authorization is merged into the headers object alongside any custom entries.
Server-side auth config (Node.js)
The Node.js reference server reads auth rules from a top-levelauthConfig object defined in server.js. Each key in the object is a path segment name (not a dot-separated string — the keys form a tree). Each node in the tree may contain a $auth function and any number of named child nodes.
$auth function signature
The Bearer token extracted from the
Authorization header. Empty string
("") if no Authorization header was sent.Path segments after the matched node. For example, if
$auth is
defined on users and the requested path is users.user1.name, then
accessArray is ["user1", "name"].What the client is trying to do. One of:
"get"— single-path read (GET ?path=)"get:batch"— path appeared in a batched read (GET ?paths=)"get:command"— freeform$getwith acommandparameter"set"—$setmutation (plain POST, no__op)"add"—$addmutation (__op: "add")"remove"—$removemutation (__op: "remove")
true to allow the request, false to deny it. The server responds with HTTP 403 on denial.
Example authConfig
This is the full authConfig from the Node.js server:
Resolution rule
The server resolves the correct$auth function using a deepest-match-wins strategy. For a requested path such as users.user1.name:
Check the deepest matching node
Look up
authConfig.users.user1.$auth. It exists, so call it with
accessArray = ["name"]. If it returns true, the request proceeds.Fall back one level
If no
$auth was found at users.user1, fall back to
authConfig.users.$auth and call it with accessArray = ["user1", "name"].Fall back to root
If that also has no match, check for a root-level
authConfig.$auth and
call it with the full segment array.Paths not matched by any
authConfig entry are open by default. Add a
root-level $auth to lock down the entire tree: