WooCommerce Code Reference

InvalidTokenException extends ApiException
in package

Thrown to signal that authentication credentials were supplied but are invalid, e.g. an unrecognised API token, a malformed Authorization header, or expired credentials.

Use this when the caller did attempt to authenticate but the credentials themselves were rejected. For "no credentials at all" use {@see}.

Wire shape: extensions.code = 'INVALID_TOKEN', HTTP status 401.

Table of Contents

__construct()  : mixed
Constructor.
getErrorCode()  : string
Get the machine-readable error code.
getExtensions()  : array<string|int, mixed>
Get the additional error metadata.
getStatusCode()  : int
Get the HTTP status code.

Methods

__construct()

Constructor.

public __construct([string $message = 'Invalid credentials.' ][, array<string|int, mixed> $extensions = array() ][, Throwable|null $previous = null ]) : mixed
Parameters
$message : string = 'Invalid credentials.'

The error message.

$extensions : array<string|int, mixed> = array()

Additional error metadata to surface in the GraphQL extensions object.

$previous : Throwable|null = null

The previous throwable for chaining.

Return values
mixed

getErrorCode()

Get the machine-readable error code.

public getErrorCode() : string
Return values
string

getExtensions()

Get the additional error metadata.

public getExtensions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getStatusCode()

Get the HTTP status code.

public getStatusCode() : int
Return values
int