Skip to content
Last updated

PERS SDK - v2.3.26 / Exports / StaticJwtAuthProvider

Class: StaticJwtAuthProvider

Simple authentication provider for static JWT tokens No token storage, refresh, or DPoP - designed for server-side use

Implements

Table of contents

Constructors

Methods

Properties

Constructors

constructor

• new StaticJwtAuthProvider(config): StaticJwtAuthProvider

Create a static JWT auth provider

Parameters

NameTypeDescription
configStaticJwtAuthProviderConfigConfiguration with JWT, project key, and auth type

Returns

StaticJwtAuthProvider

Defined in

core/auth/static-jwt-auth-provider.ts:55

• new StaticJwtAuthProvider(jwt, projectKey, authType?): StaticJwtAuthProvider

Create a static JWT auth provider (legacy constructor)

Parameters

NameTypeDescription
jwtstringStatic JWT token
projectKeystringProject key
authType?AccountOwnerTypeAuthentication type (default: AccountOwnerType.BUSINESS)

Returns

StaticJwtAuthProvider

Defined in

core/auth/static-jwt-auth-provider.ts:63

Methods

getToken

▸ getToken(): Promise<null | string>

Get the static JWT token

Returns

Promise<null | string>

The configured JWT token

Implementation of

PersAuthProvider.getToken

Defined in

core/auth/static-jwt-auth-provider.ts:94


getProjectKey

▸ getProjectKey(): Promise<null | string>

Get project key for API requests

Returns

Promise<null | string>

The configured project key

Implementation of

PersAuthProvider.getProjectKey

Defined in

core/auth/static-jwt-auth-provider.ts:102


getAuthHeaders

▸ getAuthHeaders(token): Promise<Record<string, string>>

Get authentication headers (Bearer token) Note: No DPoP support for server-side static tokens

Parameters

NameTypeDescription
tokennull | stringThe access token (ignored, uses configured JWT)

Returns

Promise<Record<string, string>>

Headers with Bearer authorization

Implementation of

PersAuthProvider.getAuthHeaders

Defined in

core/auth/static-jwt-auth-provider.ts:113


onAuthStatusChange

▸ onAuthStatusChange(status): Promise<void>

Handle authentication status changes

Note: Static JWTs cannot be refreshed automatically. TOKEN_EXPIRED status indicates manual JWT rotation is needed.

Parameters

NameTypeDescription
statusAuthStatusThe new authentication status

Returns

Promise<void>

Implementation of

PersAuthProvider.onAuthStatusChange

Defined in

core/auth/static-jwt-auth-provider.ts:126


clearTokens

▸ clearTokens(): Promise<void>

Clear tokens (no-op for static provider) Static JWTs are immutable and managed externally

Returns

Promise<void>

Defined in

core/auth/static-jwt-auth-provider.ts:144

Properties

authType

• Readonly authType: AccountOwnerType

Authentication type

Implementation of

PersAuthProvider.authType

Defined in

core/auth/static-jwt-auth-provider.ts:45