User Info
ดึงข้อมูล user จาก access token ตามมาตรฐาน OpenID Connect
Endpoint นี้ส่ง response ตรงตามมาตรฐาน OpenID Connect โดยไม่ wrap ใน {code, payload} และรับ token จาก Authorization header เท่านั้น (ไม่รับจาก body)
Endpoint
GET /oauth2/v1/userinfo
Authorization: Bearer ACCESS_TOKENหรือ
POST /oauth2/v1/userinfo
Authorization: Bearer ACCESS_TOKENRequest Headers
| Header | Required | Description |
|---|---|---|
Authorization | ✅ | Bearer ACCESS_TOKEN |
Response Format
Success Response
{
"sub": "user-credential-id",
"user_id": "456",
"employee_code": "EMP001",
"employee_name": "John",
"employee_last_name": "Doe",
"employee_nickname": "JD",
"first_name": "John",
"last_name": "Doe",
"photograph": "https://...",
"email": "user@example.com"
}Fields ที่ Return ตาม Scope
Fields ที่ได้รับจะขึ้นอยู่กับ scope ที่อยู่ใน access token:
| Scope | Fields |
|---|---|
| (always) | sub, user_id |
profile | employee_code, employee_name, employee_last_name, employee_nickname, first_name, last_name, photograph |
email | email |
Error Response — Missing Authorization Header
{
"error": "invalid_request",
"error_description": "Missing or invalid Authorization header"
}Error Response — Invalid Token
{
"error": "invalid_token",
"error_description": "Token verification failed"
}Response Fields
| Field | Type | Scope Required | Description |
|---|---|---|---|
sub | string | - | Subject identifier (user credential ID) |
user_id | string | - | User ID |
employee_code | string | profile | รหัสพนักงาน |
employee_name | string | profile | ชื่อพนักงาน |
employee_last_name | string | profile | นามสกุลพนักงาน |
employee_nickname | string | profile | ชื่อเล่นพนักงาน |
first_name | string | profile | ชื่อจริง |
last_name | string | profile | นามสกุล |
photograph | string | profile | URL รูปภาพ profile |
email | string | email | อีเมล |
Code Examples
cURL
curl -X GET https://auth.humansoft.co.th/oauth2/v1/userinfo \
-H "Authorization: Bearer ACCESS_TOKEN_HERE"Related APIs
- Token Endpoint - ขอ access token
- Token Introspection - ตรวจสอบ token
- Get JWKS - ดึง public keys สำหรับ verify JWT tokens ด้วยตัวเอง
Last updated on