OptionalallowWhether unsafe requests without Origin or Referer are allowed.
Defaults to true so server-to-server calls, tests, and older same-origin
clients keep working. Set to false for cookie-backed browser-only APIs.
OptionalprotectedUnsafe HTTP methods protected by the hook.
Defaults to POST, PUT, PATCH, and DELETE.
OptionalskipApp-owned escape hatch for routes that have another verifier, such as provider webhooks or auth callbacks.
OptionaltokenOptional double-submit cookie token check.
When configured, protected requests must send the same token in the configured header and cookie.
OptionaltrustedAdditional trusted origins allowed to send protected requests.
The request URL's own origin is always trusted. Use this for sibling
frontends such as https://app.example.com calling https://api.example.com.
OptionaltrustedShared trusted-proxy policy used when comparing the request's external
origin against Origin or Referer.
Configure this only when the app is always behind a platform or reverse
proxy that strips or normalizes forwarding headers. Without this option,
CSRF uses req.url exactly as the adapter provided it.
Options for
createCsrfHooks(...).