Skip to content

Class: NosanaConnectClient ​

Stateless OAuth 2.1 / OIDC client. Environment-agnostic: it constructs authorize URLs and performs token requests, but owns no storage and triggers no redirects — the browser wrapper (createBrowserConnect) layers those on top.

Constructors ​

Constructor ​

ts
new NosanaConnectClient(config): NosanaConnectClient;

Parameters ​

ParameterType
configConnectConfig

Returns ​

NosanaConnectClient

Methods ​

createAuthorizationRequest() ​

ts
createAuthorizationRequest(options?): Promise<AuthorizationRequest>;

Build an authorize URL plus the state (+ PKCE verifier) to keep for the callback.

Parameters ​

ParameterType
options?CreateAuthorizationOptions

Returns ​

Promise<AuthorizationRequest>


exchangeCode() ​

ts
exchangeCode(params): Promise<ConnectTokenResponse>;

Exchange an authorization code for tokens.

Parameters ​

ParameterType
paramsExchangeCodeParams

Returns ​

Promise<ConnectTokenResponse>


metadata() ​

ts
metadata(): Promise<AuthorizationServerMetadata>;

Resolve (and cache) the authorization-server metadata.

Returns ​

Promise<AuthorizationServerMetadata>


refresh() ​

ts
refresh(refreshToken): Promise<ConnectTokenResponse>;

Exchange a refresh token for a fresh token set.

Parameters ​

ParameterType
refreshTokenstring

Returns ​

Promise<ConnectTokenResponse>


userInfo() ​

ts
userInfo(accessToken): Promise<Record<string, unknown>>;

OIDC userinfo for an access token.

Parameters ​

ParameterType
accessTokenstring

Returns ​

Promise<Record<string, unknown>>