# DataClient: player() method

> The player() method of the DataClient interface resolves with the player ID the client's calls are made as.

The **`player()`** method of the [`DataClient`](/docs/client/data-client) interface resolves with the player ID the client's calls are made as. Without a token, it gets the client a guest first if it has none.

## Syntax

```ts
player()
```

### Parameters

None.

### Return value

A `Promise` that resolves with the player ID, a string: the `sub` claim of the client's token, or `guest:<random>` for a guest.

### Exceptions

[`DataError`](/docs/room/data-error)
: Rejects with this with code `E_FORBIDDEN` if the token isn't a JSON Web Token (JWT) with a `sub` claim, or if the project doesn't allow guests; `E_LIMIT` if the router has minted 30 guests in the last minute for this address and project; and `E_UNAVAILABLE` if the router can't be reached or doesn't mint a guest.

## Description

A guest's token is the one [`connect()`](/docs/client/connect) keeps, so `player()` gives the same ID as [`room.player`](/docs/client/room-client/player) of a room the guest joins, with the same `guest` option.

## Examples

### Highlighting the player's own score

The board marks the player's own entry, found by their player ID.

```ts
// highlight-me.ts
import { dataClient } from "@irtio/client";

const data = dataClient();

export async function drawBoard() {
  const [me, { entries }] = await Promise.all([data.player(), data.leaderboard("points").top({ limit: 10 })]);
  for (const e of entries) console.log(`${e.player === me ? ">" : " "} ${e.rank}. ${e.score}`);
}
```

## See also

- [`dataClient()`](/docs/client/dataclient)
- [`RoomClient.player`](/docs/client/room-client/player)
- [Games without a backend](/docs/guides/no-backend#guests)
