获取当前用户信息
GET/auth/v1/user/me
接口说明
获取当前登录用户的基础信息,包括用户资料、绑定身份源、角色权限等
入参要求:
Authorization: 当前登录用户的access_token(必填,请求头中传入,格式为Bearer xxx)client_id: 应用对应的客户端id(可选,默认为环境id)x-device-id: 设备id(可选,当前登录设备的id)
前置条件:
- 需要有效的access_token
- 用户必须已登录
出参:
- 返回完整的用户信息对象(v1Profile)
- 包含用户基本信息、绑定身份源、角色权限、状态等
获取用户信息请求示例
GET /auth/v1/user/me
Authorization: Bearer your_access_token
x-device-id: device_123456
获取用户信息响应示例
{
"sub": "9876543210123456789",
"name": "张三",
"picture": "https://example/avatar.jpg",
"username": "zhangsan",
"email": "zhangsan@example",
"phone_number": "+86 13000000000",
"providers": [
{
"id": "email",
"provider_user_id": "zhangsan@example",
"name": "邮箱登录",
"picture": "",
"url": "",
"meta": {}
}
],
"status": "ACTIVE",
"gender": "MALE",
"groups": [
{
"id": "user"
}
],
"meta": {
"department": "技术部",
"position": "开发工程师"
},
"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": "普通用户",
"last_login": "2023-01-15T10:30:00Z"
}
使用场景:
- 用户登录后获取个人信息
- 展示用户资料页面
- 检查用户权限和角色
- 获取用户绑定的登录方式
关键特性:
- 返回完整的用户信息,包括敏感信息(邮箱、手机号等)
- 包含用户绑定的所有身份源信息
- 显示用户状态和角色权限
- 提供用户扩展信息(meta字段)
Request
Responses
- 200
- 500
A successful response.
Response Headers
An unexpected error response.