Skip to main content

Function: oauthServer()

oauthServer(options): Router

Defined in: http-server-oauth/src/index.ts:89

Mounts an OAuth 2.1 Authorization Server (issuing tokens) as a Koa Router, adapting the runner-agnostic engine from @ttoss/auth-core. Exposes the authorization endpoint (PKCE S256), token endpoint (authorization_code + refresh_token), Dynamic Client Registration, and discovery metadata.

This is the opt-in "http-server with OAuth (issuing)" path — call it only when your app issues its own tokens.

Parameters

ParameterType
optionsOAuthServerOptions

Returns

Router

Example

import { App, bodyParser, oauthServer } from '@ttoss/http-server';

const app = new App();
app.use(bodyParser());
app.use(oauthServer({ issuer, clientStore, authCodeStore, issueTokens, onAuthorize }).routes());