Skip to main content

Function: oauthServer()

oauthServer(options): Router

Defined in: http-server-auth/src/oauthServer.ts:84

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 issuing side of OAuth; pair it with authMiddleware's oauth strategy (the verifying side) when one deployment both issues and verifies.

Parameters

ParameterType
optionsOAuthServerOptions

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());