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

# Authentication

> User authentication functions in the Cloud JS SDK

## getCurrentUser

`GET /auth/me`

Returns the authenticated user's profile, workspace, and credit balance.

**Parameters:** None

**Returns:** `CurrentUser`

| Field       | Type     | Description                             |
| ----------- | -------- | --------------------------------------- |
| `user`      | `object` | User info (username, email, avatar)     |
| `workspace` | `object` | Active workspace (name, slug, tier)     |
| `credits`   | `object` | Credit balance (remaining, total, used) |

**Example:**

```typescript theme={"system"}
import { createClient } from "@phala/cloud";

const client = createClient();
const me = await client.getCurrentUser();
console.log(me.user.username, me.workspace.slug);
```

<Note>
  Response shape varies by API version. The `v2026-01-21` response uses nested objects; the legacy `v2025-10-28` response uses a flat structure.
</Note>
