Oihana PHP Enums

OAuth2TokenField uses ConstantsTrait

Enumeration of OAuth 2.0 / OIDC token endpoint response fields.

These constants are used as keys when decoding a successful token response (RFC 6749 §5.1) or an error response (§5.2).

Example:

$data = json_decode( $response->getBody()->getContents() , true ) ;

$this->accessToken  = $data[ OAuth2TokenField::ACCESS_TOKEN ] ?? null ;
$this->tokenExpires = $now + ( $data[ OAuth2TokenField::EXPIRES_IN ] ?? 3600 ) - 60 ;
Tags
author

Marc Alcaraz (ekameleon)

since
1.1.0

Table of Contents

Constants

ACCESS_TOKEN  : string = 'access_token'
ACTIVE  : string = 'active'
AUD  : string = 'aud'
CLIENT_ID  : string = 'client_id'
ERROR  : string = 'error'
ERROR_DESCRIPTION  : string = 'error_description'
ERROR_URI  : string = 'error_uri'
EXP  : string = 'exp'
EXPIRES_IN  : string = 'expires_in'
IAT  : string = 'iat'
ID_TOKEN  : string = 'id_token'
ISS  : string = 'iss'
JTI  : string = 'jti'
NBF  : string = 'nbf'
REFRESH_TOKEN  : string = 'refresh_token'
SCOPE  : string = 'scope'
SUB  : string = 'sub'
TOKEN_TYPE  : string = 'token_type'
USERNAME  : string = 'username'

Constants

On this page

Search results