OAuthProtocolError
extends AuthError
in package
An RFC 6749 protocol error returned by an `/oauth2/*` endpoint as an `OAuth2ErrorResponse` body — `invalid_grant`, `invalid_client`, `invalid_request`, `unsupported_grant_type`, … (CONTRACT.md §2, §12.3 rule 3).
A language-idiomatic sub-type of AuthError (contract 1.4, addendum item 17):
it does NOT replace AuthError as a fourth peer error type, so an existing
catch (AuthError $e) block already written against this SDK's §1–§11 surface keeps
working unchanged after §12 is added — it simply also catches an OAuthProtocolError.
getMessage() is always exactly "<error>: <error_description>", built from the two
OAuth2ErrorResponse fields, which are also exposed individually as public readonly
properties (CONTRACT.md §2's error-construction rule).
Table of Contents
Properties
- $error : string
- $errorDescription : string
- $httpStatus : int|null
- $retryAfterMs : float|null
Methods
- __construct() : mixed
- getReason() : string|null
- A stable, machine-readable failure code, when this `AuthError` was raised for one of the §12.4 ID-token validation rules. `null` for every other `AuthError` in this SDK (wrong credentials, expired session, MFA failure, 401 on refresh, …).
- isAccessDenied() : bool
- Whether this is `access_denied` — at a CIBA or device poll, the user refused (CONTRACT.md §33.4, §14.2 rule 3). Distinct from {@see self::isExpiredToken()}.
- isExpiredToken() : bool
- Whether this is `expired_token` — at a CIBA or device poll, nobody decided in time; also what `cibaAwait` raises locally at its deadline (CONTRACT.md §33.4, §33.7 rule 4).
Properties
$error read-only
public
string
$error
$errorDescription read-only
public
string
$errorDescription
$httpStatus read-only
public
int|null
$httpStatus
= null
$retryAfterMs read-only
public
float|null
$retryAfterMs
= null
Methods
__construct()
public
__construct(string $error, string $errorDescription[, float|null $retryAfterMs = null ][, int|null $httpStatus = null ]) : mixed
Parameters
- $error : string
-
RFC 6749 error code (e.g.
invalid_grant,invalid_client). - $errorDescription : string
-
The server's human-readable description of self::$error.
- $retryAfterMs : float|null = null
-
The response's
Retry-Afterin milliseconds,nullwhen absent or unusable. Set for a429 rate_limit_exceeded(CONTRACT.md §14.2 rule 9), whose wait the device polling loop honours as a minimum. - $httpStatus : int|null = null
-
The HTTP status the body arrived with,
nullfor an error built locally. The device polling loop decides on it before theerrorcode (§14.2 rule 9: any429is the wait; only a400slow_downraises the interval).
getReason()
A stable, machine-readable failure code, when this `AuthError` was raised for one of the §12.4 ID-token validation rules. `null` for every other `AuthError` in this SDK (wrong credentials, expired session, MFA failure, 401 on refresh, …).
public
getReason() : string|null
Return values
string|nullisAccessDenied()
Whether this is `access_denied` — at a CIBA or device poll, the user refused (CONTRACT.md §33.4, §14.2 rule 3). Distinct from {@see self::isExpiredToken()}.
public
isAccessDenied() : bool
Return values
boolisExpiredToken()
Whether this is `expired_token` — at a CIBA or device poll, nobody decided in time; also what `cibaAwait` raises locally at its deadline (CONTRACT.md §33.4, §33.7 rule 4).
public
isExpiredToken() : bool