class CsrfTokenMismatchError
extends Error
Since 0.2.0

Thrown by the form-CSRF verifier when the submitted token is absent or does not match the session's token.

The middleware catches this and answers 403; it is exported so an application that installs the verifier itself can distinguish a CSRF failure from other rejections.

Constructors

CsrfTokenMismatchError(reason: string)
Parameters
reason: string

Why verification failed, safe to log but not to return to the client verbatim

Properties

readonly
name: string

Discriminant for consumers that cannot use instanceof across realms.

Usage

import { CsrfTokenMismatchError } from "session-plugin/src/index.ts";