[PERS SDK - v2.3.26](/sdk-reference/readme) / [Exports](/sdk-reference/modules) / StaticJwtAuthProvider

# Class: StaticJwtAuthProvider

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

## Implements

- [`PersAuthProvider`](/sdk-reference/interfaces/persauthprovider)


## Table of contents

### Constructors

- [constructor](/sdk-reference/classes/staticjwtauthprovider#constructor)


### Methods

- [getToken](/sdk-reference/classes/staticjwtauthprovider#gettoken)
- [getProjectKey](/sdk-reference/classes/staticjwtauthprovider#getprojectkey)
- [getAuthHeaders](/sdk-reference/classes/staticjwtauthprovider#getauthheaders)
- [onAuthStatusChange](/sdk-reference/classes/staticjwtauthprovider#onauthstatuschange)
- [clearTokens](/sdk-reference/classes/staticjwtauthprovider#cleartokens)


### Properties

- [authType](/sdk-reference/classes/staticjwtauthprovider#authtype)


## Constructors

### constructor

• **new StaticJwtAuthProvider**(`config`): [`StaticJwtAuthProvider`](/sdk-reference/classes/staticjwtauthprovider)

Create a static JWT auth provider

#### Parameters

| Name | Type | Description |
|  --- | --- | --- |
| `config` | [`StaticJwtAuthProviderConfig`](/sdk-reference/interfaces/staticjwtauthproviderconfig) | Configuration with JWT, project key, and auth type |


#### Returns

[`StaticJwtAuthProvider`](/sdk-reference/classes/staticjwtauthprovider)

#### Defined in

[core/auth/static-jwt-auth-provider.ts:55](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/core/auth/static-jwt-auth-provider.ts#L55)

• **new StaticJwtAuthProvider**(`jwt`, `projectKey`, `authType?`): [`StaticJwtAuthProvider`](/sdk-reference/classes/staticjwtauthprovider)

Create a static JWT auth provider (legacy constructor)

#### Parameters

| Name | Type | Description |
|  --- | --- | --- |
| `jwt` | `string` | Static JWT token |
| `projectKey` | `string` | Project key |
| `authType?` | `AccountOwnerType` | Authentication type (default: AccountOwnerType.BUSINESS) |


#### Returns

[`StaticJwtAuthProvider`](/sdk-reference/classes/staticjwtauthprovider)

#### Defined in

[core/auth/static-jwt-auth-provider.ts:63](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/core/auth/static-jwt-auth-provider.ts#L63)

## Methods

### getToken

▸ **getToken**(): `Promise`<`null` | `string`>

Get the static JWT token

#### Returns

`Promise`<`null` | `string`>

The configured JWT token

#### Implementation of

[PersAuthProvider](/sdk-reference/interfaces/persauthprovider).[getToken](/sdk-reference/interfaces/persauthprovider#gettoken)

#### Defined in

[core/auth/static-jwt-auth-provider.ts:94](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/core/auth/static-jwt-auth-provider.ts#L94)

### getProjectKey

▸ **getProjectKey**(): `Promise`<`null` | `string`>

Get project key for API requests

#### Returns

`Promise`<`null` | `string`>

The configured project key

#### Implementation of

[PersAuthProvider](/sdk-reference/interfaces/persauthprovider).[getProjectKey](/sdk-reference/interfaces/persauthprovider#getprojectkey)

#### Defined in

[core/auth/static-jwt-auth-provider.ts:102](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/core/auth/static-jwt-auth-provider.ts#L102)

### getAuthHeaders

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

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

#### Parameters

| Name | Type | Description |
|  --- | --- | --- |
| `token` | `null` | `string` | The access token (ignored, uses configured JWT) |


#### Returns

`Promise`<`Record`<`string`, `string`>>

Headers with Bearer authorization

#### Implementation of

[PersAuthProvider](/sdk-reference/interfaces/persauthprovider).[getAuthHeaders](/sdk-reference/interfaces/persauthprovider#getauthheaders)

#### Defined in

[core/auth/static-jwt-auth-provider.ts:113](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/core/auth/static-jwt-auth-provider.ts#L113)

### 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

| Name | Type | Description |
|  --- | --- | --- |
| `status` | [`AuthStatus`](/sdk-reference/enums/authstatus) | The new authentication status |


#### Returns

`Promise`<`void`>

#### Implementation of

[PersAuthProvider](/sdk-reference/interfaces/persauthprovider).[onAuthStatusChange](/sdk-reference/interfaces/persauthprovider#onauthstatuschange)

#### Defined in

[core/auth/static-jwt-auth-provider.ts:126](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/core/auth/static-jwt-auth-provider.ts#L126)

### 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](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/core/auth/static-jwt-auth-provider.ts#L144)

## Properties

### authType

• `Readonly` **authType**: `AccountOwnerType`

Authentication type

#### Implementation of

[PersAuthProvider](/sdk-reference/interfaces/persauthprovider).[authType](/sdk-reference/interfaces/persauthprovider#authtype)

#### Defined in

[core/auth/static-jwt-auth-provider.ts:45](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/core/auth/static-jwt-auth-provider.ts#L45)