Skip to Content

UnauthenticatedError

An expected request failure whose message is intentionally safe to return in a public API. Authentication or admin authorization does not make an operational error safe to disclose.

Extends

Constructors

Constructor

new UnauthenticatedError(message?, reason?): UnauthenticatedError;

Parameters

message?

string = 'Authentication required'

reason?

| "credentials_missing" | "credentials_malformed" | "token_invalid" | "token_expired" | "session_revoked" | "customer_deleted" | "customer_access_revoked" | "identity_token_invalid" | "identity_token_expired" | "identity_provider_unmatched" | "identity_subject_deleted" | "api_key_invalid" | "api_key_expired" | "api_key_revoked"

Overrides

PublicApiError.constructor

Properties

[PUBLIC_API_ERROR]

readonly [PUBLIC_API_ERROR]: true = true;

Inherited from

PublicApiError.[PUBLIC_API_ERROR]


code

readonly code: | "INVALID_REQUEST" | "UNAUTHENTICATED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "USAGE_LIMIT_EXHAUSTED" | "SERVICE_UNAVAILABLE";

Inherited from

PublicApiError.code


param

readonly param: string | null;

Inherited from

PublicApiError.param


reason

readonly reason: | ApiErrorReason | null;

Inherited from

PublicApiError.reason


requiredPermission

readonly requiredPermission: | ResourceKindPermission | null;

The permission an admin API key lacks, with a FORBIDDEN code.

Inherited from

PublicApiError.requiredPermission


retryAfterSeconds

readonly retryAfterSeconds: number | null;

How many whole seconds a client waits before retrying, with a RATE_LIMITED code. The JSON envelope does not carry it: the server that answers sets the Retry-After header from it, for example with apiErrorResponse(body, { retryAfterSeconds: error.retryAfterSeconds }).

Inherited from

PublicApiError.retryAfterSeconds


status

readonly status: PublicApiErrorStatus;

Inherited from

PublicApiError.status

Last updated on