Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/security / / OAuthClient

Interface: OAuthClient

Defined in: packages/security/src/oauth/types.ts:233

Public surface of the createOAuthClient factory. Each method accepts an AbortSignal so callers can cancel mid-flow.

Stable

Properties

PropertyModifierTypeDescriptionDefined in
metadatareadonly| DiscoveredMetadata | undefinedCached metadata; the field reflects the latest known state.packages/security/src/oauth/types.ts:239
registrationreadonly| OAuthRegistration | undefinedCached registration; the field reflects the latest known state.packages/security/src/oauth/types.ts:237
serverIdreadonlystring-packages/security/src/oauth/types.ts:234
serverUrlreadonlystring-packages/security/src/oauth/types.ts:235

Methods

authorizeCode()

ts
authorizeCode(opts?): Promise<OAuthSession>;

Defined in: packages/security/src/oauth/types.ts:256

Run the Authorization Code + PKCE flow.

Parameters

ParameterType
opts?AuthorizeCodeOptions

Returns

Promise&lt;OAuthSession&gt;


authorizeDevice()

ts
authorizeDevice(opts?): Promise<OAuthSession>;

Defined in: packages/security/src/oauth/types.ts:258

Run the Device Authorization Grant.

Parameters

ParameterType
opts?AuthorizeDeviceOptions

Returns

Promise&lt;OAuthSession&gt;


discover()

ts
discover(opts?): Promise<DiscoveredMetadata>;

Defined in: packages/security/src/oauth/types.ts:242

Run discovery. Returns the cached value when available.

Parameters

ParameterType
opts?{ force?: boolean; signal?: AbortSignal; }
opts.force?boolean
opts.signal?AbortSignal

Returns

Promise&lt;DiscoveredMetadata&gt;


refresh()

ts
refresh(opts?): Promise<OAuthSession>;

Defined in: packages/security/src/oauth/types.ts:265

Refresh the access token. Reuses the in-flight refresh promise when one is already running, so concurrent callers all observe the same network round-trip.

Parameters

ParameterType
opts?{ force?: boolean; signal?: AbortSignal; }
opts.force?boolean
opts.signal?AbortSignal

Returns

Promise&lt;OAuthSession&gt;


registerClient()

ts
registerClient(opts?): Promise<DynamicClientRegistrationResult>;

Defined in: packages/security/src/oauth/types.ts:248

Run Dynamic Client Registration. The metadata's registration_endpoint must be set; the call rejects with OAuthRegistrationUnsupportedError otherwise.

Parameters

ParameterType
opts?{ clientName?: string; redirectUris?: readonly string[]; scope?: string; signal?: AbortSignal; }
opts.clientName?string
opts.redirectUris?readonly string[]
opts.scope?string
opts.signal?AbortSignal

Returns

Promise&lt;DynamicClientRegistrationResult&gt;


revoke()

ts
revoke(opts?): Promise<void>;

Defined in: packages/security/src/oauth/types.ts:267

Revoke the current session against the discovered revocation endpoint.

Parameters

ParameterType
opts?{ reason?: string; signal?: AbortSignal; }
opts.reason?string
opts.signal?AbortSignal

Returns

Promise&lt;void&gt;


status()

ts
status(): Promise<
  | OAuthSessionMetadata
| null>;

Defined in: packages/security/src/oauth/types.ts:269

Audit-safe metadata view. Returns null when no session is stored.

Returns

Promise< | OAuthSessionMetadata | null>