Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Token Introspection

ตรวจสอบว่า token ยังใช้งานได้หรือไม่ ตามมาตรฐาน RFC 7662 

Endpoint นี้ส่ง response ตรงตามมาตรฐาน RFC 7662 โดยไม่ wrap ใน {code, payload}

Endpoint

POST /oauth2/v1/introspect Content-Type: application/json Authorization: Basic base64(client_id:client_secret)

Request Headers

HeaderRequiredDescription
AuthorizationBasic base64(client_id:client_secret)
Content-Typeapplication/json

Request Parameters

ParameterTypeRequiredDescription
tokenstringToken ที่ต้องการตรวจสอบ
token_type_hintstringชนิดของ token เช่น access_token

Response Format

Active Token

{ "active": true, "sub": "user-credential-id", "user_id": "456", "scope": "openid profile email", "aud": "my-app", "iss": "https://auth.humansoft.co.th", "iat": 1735090800, "exp": 1735094400 }

Inactive Token หรือ Credentials ไม่ถูกต้อง

{ "active": false }

ถ้า client credentials ไม่ถูกต้อง ระบบจะส่ง {"active": false} เช่นเดียวกับ token ที่หมดอายุ เพื่อไม่ให้เปิดเผยข้อมูล

Response Fields

FieldTypeDescription
activebooleantrue ถ้า token ยังใช้งานได้
substringSubject identifier (user credential ID)
user_idstringUser ID
scopestringScopes ที่ token มีสิทธิ์
audstringAudience (client_id ที่ token ถูกออกให้)
issstringIssuer URL
iatnumberIssued at (Unix timestamp)
expnumberExpiration time (Unix timestamp)

Code Examples

curl -X POST https://auth.humansoft.co.th/oauth2/v1/introspect \ -H "Content-Type: application/json" \ -H "Authorization: Basic bXktYXBwOkNMSUVOVF9TRUNSRVQ=" \ -d '{"token": "ACCESS_TOKEN_HERE"}'
Last updated on