Skip to content

AuthReason

const AuthReason: object;

Defined in: src/http/unauthorized.ts:38

The closed set of reason codes a 401 may carry.

Readers must treat an unrecognised code as AuthReason.Unauthorized — that means the server is newer, not broken.

readonly ExpiredCredential: "expired_credential" = "expired_credential";

Well-formed, but outside its validity window.

readonly InsufficientScope: "insufficient_scope" = "insufficient_scope";

Identified, but not permitted. Deliberately a 401 rather than a 403: the authenticate callback runs before any method is resolved, so there is no route yet whose permissions could be evaluated. A service wanting a true 403 raises it from the method body.

readonly InvalidCredential: "invalid_credential" = "invalid_credential";

A credential was presented and rejected.

readonly MissingCredential: "missing_credential" = "missing_credential";

No credential was presented at all.

readonly ProxyRequired: "proxy_required" = "proxy_required";

The request carried no evidence of arriving through the trusted proxy. Derived from server configuration, never from the request.

readonly Unauthorized: "unauthorized" = "unauthorized";

Refused, unclassified. The fallback.