LiveKit docs › Hooks › useToken

---

# useToken

The `useToken` hook fetches a token from the given token endpoint with the given user info.

## Import

```typescript
import { useToken } from "@livekit/components-react";

```

## Usage

```tsx
const token = useToken(<token-endpoint>, roomName, { userInfo: { identity, name }});

```

## Properties

- **`roomName`** _(string)_: 

- **`tokenEndpoint`** _(string | undefined)_: 

- **`options.userInfo`** _(UserInfo)_ (optional): 

## Returns

```typescript
string | undefined;

```

---

This document was rendered at 2026-06-07T11:32:47.463Z.
For the latest version of this document, see [https://docs.livekit.io/reference/components/react/hook/usetoken.md](https://docs.livekit.io/reference/components/react/hook/usetoken.md).

To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).