Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Get JWKS (Public Keys)

ดึง JSON Web Key Set (JWKS) ที่ประกอบด้วย public keys สำหรับ verify JWT tokens (access token และ id_token) ที่ออกโดย HMS Auth Server

Endpoint นี้ส่ง response ตรงตามมาตรฐาน JWKS โดยไม่ wrap ใน {code, payload} — สามารถใช้กับ JWKS client libraries ได้โดยตรง

Endpoint

GET /oauth2/v1/.well-known/jwks.json

Request Parameters

ไม่มี parameters

Response Format

Success Response

{ "keys": [ { "kid": "key-id-uuid", "kty": "RSA", "n": "modulus_base64url", "e": "AQAB", "use": "sig", "alg": "RS256" } ] }

Response Fields

FieldTypeDescription
keysarrayรายการ public keys
keys[].kidstringKey ID — ใช้จับคู่กับ kid ใน JWT header
keys[].ktystringKey type — จะเป็น RSA เสมอ
keys[].nstringRSA modulus (Base64URL encoded)
keys[].estringRSA exponent (Base64URL encoded) — ปกติจะเป็น AQAB
keys[].usestringการใช้งาน — sig (signature)
keys[].algstringAlgorithm — RS256

Code Examples

curl -X GET https://auth.humansoft.co.th/oauth2/v1/.well-known/jwks.json

Notes

  • ควรใช้ cache สำหรับ JWKS เพื่อลดการเรียก API ซ้ำ แนะนำให้ cache อย่างน้อย 24 ชั่วโมง
  • ใช้ kid (Key ID) จาก JWT header เพื่อเลือก key ที่ถูกต้องจาก JWKS
  • Tokens ทั้งหมดใช้ algorithm RS256 (RSA Signature with SHA-256)
  • Token Endpoint - ขอ token
  • Token Introspection - ตรวจสอบ token ผ่าน API (ทางเลือกแทนการ verify ด้วย JWKS)
  • User Info - ดึงข้อมูล user จาก access token
Last updated on