Function: createOAuthHandlers()
createOAuthHandlers(
options):OAuthHandlers
Defined in: auth-core/src/oauthServer.ts:432
Creates runner-agnostic OAuth 2.1 Authorization Server handlers.
Implements the authorization endpoint (PKCE S256 required), token endpoint
(authorization_code + refresh_token grants), Dynamic Client Registration
(RFC 7591), and discovery metadata (RFC 8414, plus RFC 9728 when resource
is set). The handlers operate on plain OAuthRequest /
OAuthResponse objects, so any HTTP runtime can host them through a
thin adapter — @ttoss/http-server provides the Koa one.
The app owns its user model, signing keys, and login/consent UI through the option hooks; this core never sees them.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | OAuthServerOptions | Authorization server configuration and pluggable hooks. |
Returns
Example
const oauth = createOAuthHandlers({ issuer, clientStore, authCodeStore, issueTokens, onAuthorize });
const res = await oauth.token({ query: {}, body, headers });