Skip to main content

DefaultParallelModelAuthentication

ParallelModel TypeScript SDK


Class: DefaultParallelModelAuthentication

Defined in: transport.ts:147

OAuth authentication manager that discovers scopes, obtains access tokens and caches them until refresh is needed.

Constructors​

Constructor​

new DefaultParallelModelAuthentication(transport): DefaultParallelModelAuthentication

Defined in: transport.ts:154

Creates a DefaultParallelModelAuthentication instance.

Parameters​

transport​

Transport

Shared HTTP transport and authentication context.

Returns​

DefaultParallelModelAuthentication

Methods​

authenticateAsync()​

authenticateAsync(signal?): Promise<string>

Defined in: transport.ts:168

Obtains an OAuth access token, reusing the cached token when valid.

Parameters​

signal?​

AbortSignal

Optional abort signal used to cancel local waiting or HTTP requests.

Returns​

Promise<string>

The OAuth bearer access token.


getScopesAsync()​

getScopesAsync(signal?): Promise<ScopeModel[]>

Defined in: transport.ts:161

Retrieves, validates and deduplicates OAuth scope definitions.

Parameters​

signal?​

AbortSignal

Optional abort signal used to cancel local waiting or HTTP requests.

Returns​

Promise<ScopeModel[]>

The validated, deduplicated OAuth scope definitions.


getTokenAsync()​

getTokenAsync(signal?): Promise<string>

Defined in: transport.ts:175

Returns the cached access token or refreshes it when required.

Parameters​

signal?​

AbortSignal

Optional abort signal used to cancel local waiting or HTTP requests.

Returns​

Promise<string>

The valid OAuth access token.


refreshAsync()​

refreshAsync(signal?): Promise<string>

Defined in: transport.ts:190

Refreshes the OAuth token, sharing an in-flight refresh among callers.

Parameters​

signal?​

AbortSignal

Optional abort signal used to cancel local waiting or HTTP requests.

Returns​

Promise<string>

The refreshed OAuth access token.


refreshIfRejectedAsync()​

refreshIfRejectedAsync(rejected, signal?): Promise<string>

Defined in: transport.ts:183

Obtains a replacement token after a rejected token, reusing a newer valid token if present.

Parameters​

rejected​

string

Access token rejected by the server.

signal?​

AbortSignal

Optional abort signal used to cancel local waiting or HTTP requests.

Returns​

Promise<string>

A valid replacement access token.