Function: oauthServer()
oauthServer(
options):Router
Defined in: http-server-auth/src/oauthServer.ts:60
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,
plus refresh_token when onRefreshToken is set), Dynamic Client
Registration, and discovery metadata. Discovery and registration advertise
refresh_token only when onRefreshToken is set.
This is the issuing side of OAuth; pair it with authMiddleware's oauth
strategy (the verifying side) when one deployment both issues and verifies.
Parameters
| Parameter | Type |
|---|---|
options | OAuthServerOptions |
Returns
Router
Example
import { App, bodyParser } from '@ttoss/http-server';
import { oauthServer } from '@ttoss/http-server-auth';
const app = new App();
app.use(bodyParser());
app.use(oauthServer({ issuer, clientStore, authCodeStore, issueTokens, onAuthorize }).routes());