Get Current User Information
GET/auth/v1/user/me
API Description
Get the current logged-in user's basic information, including user profile, bound identity sources, role permissions, etc.
Input Requirements:
Authorization: Current logged-in user's access_token (required, passed in request header, format Bearer xxx)client_id: Client ID corresponding to the application (optional, defaults to environment ID)x-device-id: Device ID (optional, current logged-in device ID)
Prerequisites:
- Need valid access_token
- User must be logged in
Output:
- Returns complete user information object (v1Profile)
- Includes user basic information, bound identity sources, role permissions, status, etc.
Get User Information Request Example
GET /auth/v1/user/me
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FwaS5leGFtcGxlLmNvbSIsInN1YiI6Ijk4NzY1NDMyMTAxMjM0NTY3ODkiLCJhdWQiOiJkZW1vLWFwcC0yZjhhOWMzZTFiNGQiLCJleHAiOjE3MzQ2NzU4ODksImlhdCI6MTczNDY2ODY4OSwic2NvcGUiOiJ1c2VyIn0.dGhpc19pc19hX2Zha2Vfc2lnbmF0dXJlX2Zvcl9leGFtcGxlX3B1cnBvc2VzX29ubHlfZG9fbm90X3VzZV9pbl9wcm9kdWN0aW9uX2Vudmlyb25tZW50X3RoaXNfaXNfbm90X3JlYWxfdG9rZW5fZGF0YQ
x-device-id: device_123456
Get User Information Response Example
{
"sub": "9876543210123456789",
"name": "Zhang San",
"picture": "https://example/avatar.jpg",
"username": "zhangsan",
"email": "zhangsan@example",
"phone_number": "+86 13000000000",
"providers": [
{
"id": "email",
"provider_user_id": "zhangsan@example",
"name": "Email Login",
"picture": "",
"url": "",
"meta": {}
}
],
"status": "ACTIVE",
"gender": "MALE",
"groups": [
{
"id": "user"
}
],
"meta": {
"department": "Technology Department",
"position": "Development Engineer"
},
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-15T10:30:00Z",
"password_updated_at": "2023-01-01T00:00:00Z",
"user_id": "9876543210123456789",
"has_password": true,
"internal_user_type": "generalUser",
"type": "external",
"user_source": 1,
"user_desc": "Regular User",
"last_login": "2023-01-15T10:30:00Z"
}
Usage Scenarios:
- Get personal information after user login
- Display user profile page
- Check user permissions and roles
- Get user's bound login methods
Key Characteristics:
- Returns complete user information, including sensitive information (email, phone number, etc.)
- Includes all identity sources bound to user
- Shows user status and role permissions
- Provides user extended information (meta field)
Request
Query Parameters
Client ID corresponding to the application, can be obtained from Cloud Development Platform -> Identity Authentication -> Development Settings. Defaults to environment ID, can be omitted
Header Parameters
Device ID, the ID of the current logged-in device. The client should generate it randomly and cache it on the client. This parameter is related to the number of logged-in accounts.
The access_token of the current logged-in user, format is Bearer xxx
- application/json
Body
- any
Responses
- 200
- 500
A successful response.
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- ]
- Array [
- ]
User subject
User nickname
User avatar
Username
Phone number
providers object[]
Linked login methods
Identity provider ID
Provider user ID
Identity provider name
Identity provider avatar
Identity provider URL
meta object
Identity provider metadata
Possible values: [DEFAULT, ACTIVE, PENDING, BLOCKED]
User status
Gender
groups object[]
User groups, list of role identifiers bound to the user
Role identifier
meta object
User metadata
Creation time
Update time
Password update time
Micro-app user ID
Indicates if a password is set
Internal user type: built-in super admin (administrator), general user (generalUser)
User type: internal, external
User source: 1-self-built, 2-WeCom enterprise, 3-external registration
User description
WeChat or WeCom openID
Corporation ID
Direct supervisor ID
Main department ID
Sort value; lower sort means higher priority
Last login time
{
"sub": "string",
"name": "string",
"picture": "string",
"username": "string",
"email": "string",
"phone_number": "string",
"providers": [
{
"id": "string",
"provider_user_id": "string",
"name": "string",
"picture": "string",
"url": "string",
"meta": {}
}
],
"status": "DEFAULT",
"gender": "string",
"groups": [
{
"id": "string"
}
],
"meta": {},
"created_at": "2024-07-29T15:51:28.071Z",
"updated_at": "2024-07-29T15:51:28.071Z",
"password_updated_at": "2024-07-29T15:51:28.071Z",
"user_id": "string",
"has_password": true,
"internal_user_type": "string",
"type": "string",
"user_source": 0,
"user_desc": "string",
"open_id": "string",
"corp_id": "string",
"parent_user_id": "string",
"main_dep": "string",
"sort": 0,
"last_login": "2024-07-29T15:51:28.071Z"
}
An unexpected error response.
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
{
"error": "string",
"error_code": 0,
"error_description": "string"
}