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
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, …).
Properties
$error read-only
public
string
$error
$errorDescription read-only
public
string
$errorDescription
Methods
__construct()
public
__construct(string $error, string $errorDescription) : 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.
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