BearerAuthErrorOptions class

Options for customizing an individual error response in bearerAuth.

message receives the Context and returns the response body. Return a String for plain-text or a Map for JSON. When null, the middleware uses its built-in default.

wwwAuthenticate overrides the WWW-Authenticate header sent with the error response. When null, a standards-compliant default is used.

BearerAuthErrorOptions(
  message: (c) => {'error': 'Token missing', 'path': c.req.path},
  wwwAuthenticate: 'Bearer realm="myapp"',
)

Constructors

BearerAuthErrorOptions({FutureOr message(Context c)?, String? wwwAuthenticate})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
message FutureOr Function(Context c)?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
wwwAuthenticate String?
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited