Skip to main content

Class: FetchClient

Wrapper around fetch to perform authenticated requests to a resource server

The provided CredentialOrchestrator is used to retrieve Tokens which match the criteria passed in via FetchClientAuthOptions, like issuer, client and scopes. Once a valid Token is found, the request is made

Constructors

new FetchClient()

new FetchClient(orchestrator, options): FetchClient

Parameters

orchestrator: CredentialOrchestrator

options: FetchClientOptions

Returns

FetchClient

Methods

on()

on(eventName, handler): EventEmitter

Parameters

eventName: string

handler

Returns

EventEmitter


off()

off(eventName, handler): EventEmitter

Parameters

eventName: string

handler

Returns

EventEmitter


fetch()

fetch(input, options): Promise<Response>

Parameters

input: string | URL

options: Partial<FetchClientOptions> & RequestInit = {}

Returns

Promise<Response>