Skip to content

covenix / oauth2

Function: oauth2()

oauth2(flows, handler): SecurityScheme

Defined in: src/security.ts:91

Builds an OAuth2 security scheme.

Parameters

flows

The OAuth2 flows object (implicit/password/clientCredentials/authorizationCode).

authorizationCode?

{ authorizationUrl: string; refreshUrl?: string; scopes: {[scope: string]: string; }; tokenUrl: string; }

authorizationCode.authorizationUrl

string

authorizationCode.refreshUrl?

string

authorizationCode.scopes

{[scope: string]: string; }

authorizationCode.tokenUrl

string

clientCredentials?

{ refreshUrl?: string; scopes: {[scope: string]: string; }; tokenUrl: string; }

clientCredentials.refreshUrl?

string

clientCredentials.scopes

{[scope: string]: string; }

clientCredentials.tokenUrl

string

implicit?

{ authorizationUrl: string; refreshUrl?: string; scopes: {[scope: string]: string; }; }

implicit.authorizationUrl

string

implicit.refreshUrl?

string

implicit.scopes

{[scope: string]: string; }

password?

{ refreshUrl?: string; scopes: {[scope: string]: string; }; tokenUrl: string; }

password.refreshUrl?

string

password.scopes

{[scope: string]: string; }

password.tokenUrl

string

handler

SecurityHandler

Resolves the request to a principal, or null for 401.

Returns

SecurityScheme