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

# SessionApi

Read access to the current session.

## Methods

### get()

> **get**(): [`Session`](Session.md)

Current session: a frozen object, with the same reference between calls while the tokens do not
change. Safe to use with `useSyncExternalStore` (React) without a re-render loop.

#### Returns

[`Session`](Session.md)

#### Example

```ts
if (enginex.session.get().status === 'authenticated') showWallet()
```

***

### subscribe()

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

Subscribes to session changes; returns the function to cancel.

#### Parameters

##### listener

(`session`) => `void`

#### Returns

() => `void`

#### Example

```ts
const off = enginex.session.subscribe((s) => console.log(s.status))
```
