AuthorizationCodeStore
AuthorizationCodeStore
Default DBI-backed Hazaar\OAuth\Interface\AuthorizationCodeStore implementation.
class AuthorizationCodeStore implements \Hazaar\OAuth\Interface\AuthorizationCodeStoreImplements: Hazaar\OAuth\Interface\AuthorizationCodeStore
Expects a table (default oauth_authorization_codes) with columns code (primary key), client_id, redirect_uri, code_challenge, code_challenge_method, user_identity, scope (JSON text), resource and expires_at. This implementation does not require or provide a schema migration — any text/varchar/json column types work.
Hazaar\OAuth\Store\DBI\AuthorizationCodeStore::consume deletes and reads back the row in a single DELETE ... RETURNING statement, so a code can never be redeemed twice - even under concurrent requests for the same code, only the request whose delete removed the row receives it; the others get nothing.
Configuration (oauth.server.codes_options):
database(string|array, optional): passed to Hazaar\DBI\Adapter::create. Defaults to the application's default database connection.table(string, optional): table name. Defaults tooauth_authorization_codes.
Properties
table
private Table $tableType: Hazaar\DBI\Table
Methods
__construct
public __construct(array|Options $options = 'new Options()'): voidParameters
| Parameter | Type | Description |
|---|---|---|
$options | array | Hazaar\OAuth\Store\DBI\Options |
save
public save(AuthorizationCode $code): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$code | Hazaar\OAuth\AuthorizationCode |
consume
public consume(string $code): ?AuthorizationCodeReturns: Hazaar\OAuth\AuthorizationCode
Parameters
| Parameter | Type | Description |
|---|---|---|
$code | string |
Generated by Hazaar API Doc Generator on Sun, 23 Aug 2026 10:49:43 +0000