---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk/interfaces/TokenStore.md
---
[Reference](../../../index.md) / [@getenginex/sdk](../index.md) / TokenStore

# TokenStore

Where the SDK keeps the tokens. Implement it to use cookies, IndexedDB etc.

## Methods

### clear()

> **clear**(): `void`

Removes the tokens.

#### Returns

`void`

***

### get()

> **get**(): [`Tokens`](Tokens.md) | `null`

Current tokens or `null` without a session. Must be synchronous and cheap. If it throws, `createEnginexClient`
and `session.get()` do not throw (the session stays as it was — anonymous at creation) and the error shows up
as an `EnginexError` on the next request that needs the tokens.

#### Returns

[`Tokens`](Tokens.md) | `null`

***

### set()

> **set**(`tokens`): `void`

Stores new tokens.

#### Parameters

##### tokens

[`Tokens`](Tokens.md)

#### Returns

`void`

***

### subscribe()

> **subscribe**(`listener`): () => `void`

Notifies when the tokens change (including from another tab). Returns the cancel function.

#### Parameters

##### listener

() => `void`

#### Returns

() => `void`
