AuthorizationCodeStore
Less than 1 minute
AuthorizationCodeStore
Storage for short-lived, single-use authorization codes.
interface AuthorizationCodeStoreImplement this against whatever persistence an application already uses and bind it via the oauth.server.codes config key. Hazaar\OAuth\Store\DBI\AuthorizationCodeStore provides a ready-to-use DBI-backed implementation.
Methods
__construct
Construct the store.
public __construct(array $config): voidParameters
| Parameter | Type | Description |
|---|---|---|
$config | array |
save
Persists a newly-minted authorization code.
public save(AuthorizationCode $code): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$code | Hazaar\OAuth\AuthorizationCode |
consume
Atomically retrieves and invalidates a code, so it can never be redeemed twice.
public consume(string $code): ?AuthorizationCodeReturns: Hazaar\OAuth\AuthorizationCode
Implementations must delete (or otherwise permanently invalidate) the record as part of this call, before returning — codes are single-use per RFC 6749 §4.1.2.
Parameters
| Parameter | Type | Description |
|---|---|---|
$code | string |
Generated by Hazaar API Doc Generator on Sun, 23 Aug 2026 10:49:43 +0000