---
name: "getCurrentUser"
mode: "api"
versionRequirements:
  - { name: "@ray-js/lock-sdk", version: "1.0.0" }
title: "getCurrentUser - Get current user information."
summary: "Get current user information."
---

## getCurrentUser

> [VERSION] @ray-js/lock-sdk >= 1.0.0

### Description

Get the current user

### Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `isForce` | `boolean` | No | Whether to force a refresh |

### Return Value

Type: `Promise<CurrentUser>`

User snapshot

##### CurrentUser

| Property | Type | Description |
| --- | --- | --- |
| `userId` | `string` | Cloud user ID |
| `lockUserId` | `number` | Lock-side user ID |
| `userType` | `10 \| 20 \| 30 \| 40 \| 50` | User type (admin/regular, etc.) |
| `allOpenDps` | `string` | Encoded string of the DP set that supports remote unlocking |
| `allOpenType` | `number[]` | List of supported unlock method type IDs |
| `productAttribute` | `number` | Product attribute bits |
| `phase` | `number` | User status: 0 Frozen, 1 Normal, 5 Expired, 6 Not effective, 7 Deleted |
| `admin` | `boolean` | Is admin |
| `offlineUnlock` | `boolean` | Whether offline unlocking is allowed |
| `permanent` | `boolean` | Whether the user is permanently valid |
| `expireTime` | `number` | Expiration time (s) |
| `effectiveTime` | `number` | Activation time (s) |
| `expireDay` | `number` | Absolute expiration day count |

### Examples

#### Example

```ts
import { getCurrentUser } from '@ray-js/lock-sdk';
const user = await getCurrentUser();
```
