OptionalalgThe cookie to use for the bearer token.
If provided the cookie will be parsed to try to extract the JWT.
OptionalinvalidThe message to return when the user is invalid.
If a function is provided, it will be called with the request and context as arguments.
If the function returns a string, it will be used as the message.
If the function returns an object, it will be serialized as JSON and used as the response body.
"Invalid user"
(args) => `Invalid user: ${args.request.headers.get("X-User")}`
async (args) => {
let user = await getUser(args.context);
return `Invalid user: ${user}`;
}
{ error: "Invalid user" }
(args) => ({
error: `Invalid user: ${args.request.headers.get("X-User")}`
})
async (args) => {
let user = await getUser(args.context);
return { error: `Invalid user: ${user}` };
}
The URL of the JWKS endpoint.
OptionalrealmThe domain name of the realm, as part of the returned WWW-Authenticate challenge header.
Optionalverify
The algorithm to use for verifying the JWT signature.