> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt
> Use this file to discover all available pages before exploring further.

# React Native Manage Sessions

> Restore sessions, manage access, and sign out with the React Native OMS Wallet SDK.

Use the React Native SDK session APIs after creating `OMSClient` to restore wallet state, issue ID tokens, and manage wallet access. Completed wallet sessions are persisted between app launches.

## Get Wallet Address

Read the active wallet address after client creation and session restore.

```typescript theme={null}
const walletAddress = await oms.wallet.getWalletAddress()

if (walletAddress) {
  console.log('Restored wallet:', walletAddress)
}
```

**Parameters**

Takes no parameters.

**Returns**

Returns `Promise<string | null>`.

## Get Session

Read completed wallet-session metadata.

```typescript theme={null}
const session = await oms.wallet.getSession()

console.log(session.walletAddress, session.expiresAt, session.loginType)
```

**Parameters**

Takes no parameters.

**Returns**

Returns `Promise<OmsClientSessionState>`.

| Field           | Type                                           | Description                                               |
| --------------- | ---------------------------------------------- | --------------------------------------------------------- |
| `walletAddress` | `string` or `null`                             | Active wallet address, when a session is restored.        |
| `expiresAt`     | `string` or `null`                             | Session expiration timestamp.                             |
| `loginType`     | `'Email'`, `'GoogleAuth'`, `'Oidc'`, or `null` | Login method for the session.                             |
| `sessionEmail`  | `string` or `null`                             | Email address associated with the session when available. |

## On Session Expired

Subscribe to wallet session expiration events. The listener receives the expired session snapshot so your app can route the user back to sign-in or prefill re-authentication UI.

```typescript theme={null}
const subscription = oms.wallet.onSessionExpired((event) => {
  console.log('Session expired at:', event.expiredAt)
  console.log('Expired wallet:', event.session.walletAddress)
})
```

Keep the subscription active while the screen or service needs updates. Call `subscription.remove()` when that owner is disposed.

**Parameters**

| Parameter  | Type                                            | Description                                              |
| ---------- | ----------------------------------------------- | -------------------------------------------------------- |
| `listener` | `(event: OmsClientSessionExpiredEvent) => void` | Callback invoked when the active wallet session expires. |

**Returns**

Returns `{ remove(): void }`.

| Field       | Type                    | Description                 |
| ----------- | ----------------------- | --------------------------- |
| `session`   | `OmsClientSessionState` | Expired session snapshot.   |
| `expiredAt` | `string`                | Expiration event timestamp. |

## Get ID Token

Request an ID token for the active wallet session. Send this token to your backend when using [backend wallet verification](/wallets/sdk/guides/backend-wallet-verification).

```typescript theme={null}
const idToken = await oms.wallet.getIdToken({
  ttlSeconds: 300,
})
```

**Parameters**

| Parameter      | Type                                            | Description                                                                                                         |
| -------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `ttlSeconds`   | `number`, `null`, or undefined                  | Optional token lifetime in seconds.                                                                                 |
| `customClaims` | `Record<string, unknown>`, `null`, or undefined | Optional app-provided claims. Backends should treat them as client-provided context unless they control the values. |

**Returns**

Returns `Promise<string>`.

## List Access

List wallet access grants for account-management UI.

```typescript theme={null}
const credentials = await oms.wallet.listAccess({ pageSize: 25 })

for (const credential of credentials) {
  console.log(credential.credentialId, credential.expiresAt, credential.isCaller)
}
```

**Parameters**

| Parameter  | Type                           | Description                                      |
| ---------- | ------------------------------ | ------------------------------------------------ |
| `pageSize` | `number`, `null`, or undefined | Optional page size for paginated access results. |

**Returns**

Returns `Promise<OmsCredentialInfo[]>`.

## List Access Pages

Use `listAccessPages` when your UI should render credential access one page at a time.

```typescript theme={null}
for await (const page of oms.wallet.listAccessPages({ pageSize: 25 })) {
  for (const credential of page.credentials) {
    console.log(credential.credentialId, credential.isCaller)
  }
}
```

**Parameters**

| Parameter  | Type                           | Description                                      |
| ---------- | ------------------------------ | ------------------------------------------------ |
| `pageSize` | `number`, `null`, or undefined | Optional page size for each access-list request. |

**Returns**

Returns `AsyncGenerator<OmsListAccessResponse, void, void>`.

## List Access Page

Fetch one credential access page with an optional cursor.

```typescript theme={null}
const page = await oms.wallet.listAccessPage({
  pageSize: 25,
  cursor: null,
})

console.log('Credential count:', page.credentials.length)
```

**Parameters**

| Parameter  | Type                           | Description                                      |
| ---------- | ------------------------------ | ------------------------------------------------ |
| `pageSize` | `number`, `null`, or undefined | Optional page size for this access-list request. |
| `cursor`   | `string`, `null`, or undefined | Cursor returned by a previous page.              |

**Returns**

Returns `Promise<OmsListAccessResponse>`.

| Field         | Type                      | Description                                               |
| ------------- | ------------------------- | --------------------------------------------------------- |
| `credentials` | `OmsCredentialInfo[]`     | Credentials returned for the page.                        |
| `page`        | `OmsAccessPage` or `null` | Pagination metadata, including `limit` and next `cursor`. |

## Revoke Access

Revoke another credential's access to the active wallet.

```typescript theme={null}
await oms.wallet.revokeAccess('credential-id')
```

**Parameters**

| Parameter            | Type     | Description                             |
| -------------------- | -------- | --------------------------------------- |
| `targetCredentialId` | `string` | Credential ID returned by `listAccess`. |

**Returns**

Returns `Promise<void>`.

## Sign Out

Clear the active wallet session.

```typescript theme={null}
await oms.wallet.signOut()
```

**Parameters**

Takes no parameters.

**Returns**

Returns `Promise<void>`.
