---
url: https://game-engine-io.github.io/enginex-frontend-sdk/flows/profile.md
---
# Profile and sessions

The `profile` namespace reads and updates the logged-in player's data and lists the devices with an
open session. All methods require login: without a session (or if it cannot be refreshed), they reject
with `UNAUTHENTICATED` before any call. In tests, the `createMockFetch` from
[`@getenginex/sdk/testing`](/guide/testing) already answers `/me` and `/me/sessions` with realistic data.

## Read the profile

```ts
const me = await enginex.profile.get()
me.displayName // 'Ana Souza'
me.emailVerified // true
me.cpf // '***.456.789-**'
```

The CPF **always comes masked** from the gateway; the SDK has no way to return it in full. Fields with no
value (`avatarUrl`, `phone`...) arrive as empty text, and `createdAt` is an ISO 8601 date in UTC.

## Update the profile

Only `username` and `displayName` can be updated. Provide at least one (the type does not compile with an
empty object); empty text is rejected by the gateway with `INVALID_ARGUMENT` (400). The response is the
full, already updated profile:

```ts
try {
  const me = await enginex.profile.update({ displayName: 'Ana S.' })
} catch (e) {
  if (isEnginexError(e, 'INVALID_ARGUMENT')) showError(e.message)
  else throw e
}
```

Email, phone and password have their own flows in [Sign-up](/flows/sign-up) and [Password](/flows/password).

## Login sessions

```ts
const sessions = await enginex.profile.listSessions()
const others = sessions.filter((s) => !s.current)

await enginex.profile.revokeSession({ sessionId: others[0].id }) // encerra o outro dispositivo
```

Each session has `id`, `ip`, `device` (user agent), `lastActive` and `current` (the session that made
the request).

::: warning Current state of the gateway
Today the gateway returns only the current session (`id: 'current'`), with `lastActive` as free text
(`'now'`), and `DELETE /me/sessions/{id}` responds with success without actually revoking anything
(session management has not been wired to the authentication service yet). The SDK already exposes the
final contract; do not treat `lastActive` as a date and do not rely on `revokeSession` for security until
the gateway implements it.
:::
