Skip to main content

getOrCreateDynamicClient

Agent Runtimes


Agent Runtimes / identity/dcr / getOrCreateDynamicClient

Function: getOrCreateDynamicClient()

getOrCreateDynamicClient(issuerUrl, options): Promise<DynamicClient>

Defined in: identity/dcr.ts:340

Get or create a dynamic client for an OAuth provider

This is the main entry point for DCR. It:

  1. Checks if we already have a registered client for this issuer
  2. If not, discovers the authorization server metadata
  3. If DCR is supported, registers a new client
  4. Stores the client for future use

Parameters

issuerUrl

string

The OAuth provider's issuer URL

options

Registration options

clientName?

string

Application name

forceNew?

boolean

Force re-registration even if client exists

initialAccessToken?

string

Optional initial access token for protected endpoints

redirectUris

string[]

Redirect URIs

scopes?

string[]

Requested scopes

Returns

Promise<DynamicClient>

The dynamic client information

Throws

Error if DCR is not supported or registration fails