Attributes
4 weeks ago
Enums
2 months ago
Infrastructure
4 weeks ago
InputTypes
2 months ago
Interfaces
2 months ago
Mutations
2 months ago
Pagination
2 months ago
Queries
4 weeks ago
Scalars
2 months ago
Traits
2 months ago
Types
2 months ago
Utils
4 weeks ago
ApiException.php
2 months ago
ForbiddenException.php
4 weeks ago
InvalidTokenException.php
4 weeks ago
NotFoundException.php
4 weeks ago
UnauthorizedException.php
4 weeks ago
ValidationException.php
4 weeks ago
InvalidTokenException.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Automattic\WooCommerce\Api; |
| 6 | |
| 7 | /** |
| 8 | * Thrown to signal that authentication credentials were supplied but are |
| 9 | * invalid, e.g. an unrecognised API token, a malformed Authorization header, |
| 10 | * or expired credentials. |
| 11 | * |
| 12 | * Use this when the caller *did* attempt to authenticate but the credentials |
| 13 | * themselves were rejected. For "no credentials at all" use |
| 14 | * {@see UnauthorizedException}. |
| 15 | * |
| 16 | * Wire shape: `extensions.code = 'INVALID_TOKEN'`, HTTP status 401. |
| 17 | */ |
| 18 | class InvalidTokenException extends ApiException { |
| 19 | /** |
| 20 | * Constructor. |
| 21 | * |
| 22 | * @param string $message The error message. |
| 23 | * @param array $extensions Additional error metadata to surface in the GraphQL `extensions` object. |
| 24 | * @param ?\Throwable $previous The previous throwable for chaining. |
| 25 | */ |
| 26 | public function __construct( |
| 27 | string $message = 'Invalid credentials.', |
| 28 | array $extensions = array(), |
| 29 | ?\Throwable $previous = null, |
| 30 | ) { |
| 31 | parent::__construct( $message, 'INVALID_TOKEN', $extensions, 401, $previous ); |
| 32 | } |
| 33 | } |
| 34 |