ประกวดราคาจ้างจ้างพัฒนาแพลตฟอร์มดิจิทัลกลางด้านการแพทย์แผนไทยและการแพทย์ทางเลือก ด้วยเทคโนโลยีปัญญาประดิษฐ์
คู่มือการเชื่อมต่อระบบด้วย OAuth ของ Provider ID ฉบับนี้ จัดทำขึ้นเพื่อให้ผู้พัฒนาระบบ (RP - Relying Party) สามารถนำไปประยุกต์ใช้ในการเชื่อมต่อระบบยืนยันตัวตนกลางได้อย่างถูกต้องตามมาตรฐานสากล โดยมีวัตถุประสงค์หลักเพื่อเพิ่มความปลอดภัยและมาตรฐานในการเข้าถึงข้อมูลส่วนบุคคลของผู้ใช้งานในระบบสาธารณสุข
ขอบเขตของงานประกอบด้วยการติดตั้งปุ่ม “Login with Provider ID” บนแอปพลิเคชัน การจัดการกระบวนการ Authentication Request เพื่อขอรับ Authorization Code และการดำเนินการในฝั่ง Backend เพื่อแลกเปลี่ยน Code ดังกล่าวเป็น Access Token และ Refresh Token ผ่าน API ที่กำหนด นอกจากนี้ยังมี API สำหรับดึงข้อมูลโปรไฟล์ผู้ใช้งาน (Profile Request) ซึ่งรวมถึงข้อมูลเลขบัตรประชาชน, ชื่อ-นามสกุล, ข้อมูลหน่วยบริการ และสิทธิ์การใช้งานต่างๆ (เช่น is_hr_admin, is_director)
ผู้พัฒนาจะต้องปฏิบัติตามขั้นตอนการรักษาความปลอดภัยอย่างเคร่งครัด เช่น การใช้ Basic Authentication (Client ID & Secret Key) ในการเรียกใช้ API และการจัดการ Token ให้เป็นไปตามอายุการใช้งานที่กำหนด (Access Token และ Refresh Token ที่มีอายุ 60 วัน) รวมถึงการตรวจสอบสถานะของ Token ผ่าน Introspect API เพื่อให้มั่นใจว่าการเชื่อมต่อมีความปลอดภัยและเป็นปัจจุบันอยู่เสมอ
English summary
This document serves as a technical guide for integrating Web or Mobile Applications with the Provider ID system using the OAuth 2.0 standard. It outlines the authentication flow, including sending Authentication Requests, exchanging Authorization Codes for Access/Refresh Tokens, and retrieving user profiles. The guide covers API specifications for profile data, public key retrieval, and token introspection, ensuring secure and standardized identity verification for Relying Parties (RP).
ข้อมูลเชิงลึกของโครงการ
AI วิเคราะห์เป้าหมายโครงการ
- เพื่อให้ระบบภายนอก (RP) สามารถเชื่อมต่อและยืนยันตัวตนผู้ใช้งานผ่าน Provider ID ได้อย่างปลอดภัย
- เพื่อกำหนดมาตรฐานการแลกเปลี่ยนข้อมูลส่วนบุคคลผ่านโปรโตคอล OAuth 2.0
- เพื่อเพิ่มประสิทธิภาพในการจัดการสิทธิ์การเข้าถึงข้อมูลของผู้ใช้งานในระบบสาธารณสุข
- เพื่อรองรับการดึงข้อมูลโปรไฟล์และข้อมูลหน่วยบริการของผู้ใช้งานอย่างถูกต้องและเป็นระบบ
ขอบเขตของงาน
- พัฒนาปุ่ม Login with Provider ID บน Web/Mobile Application
- จัดทำกระบวนการส่ง Authentication Request และรับ Authorization Code
- พัฒนา Backend API สำหรับแลกเปลี่ยน Authorization Code เป็น Access Token
- จัดทำระบบจัดการ Refresh Token เพื่อรักษา Session ของผู้ใช้งาน
- พัฒนาการเรียกใช้ API Profile เพื่อดึงข้อมูลส่วนบุคคลและข้อมูลองค์กร
- พัฒนาระบบตรวจสอบความถูกต้องของ Token (Token Introspection)
- จัดการความปลอดภัยในการสื่อสารผ่าน Basic Authentication (Client ID/Secret Key)
สิ่งที่ต้องส่งมอบ
- ระบบ Login ที่เชื่อมต่อกับ Provider ID
- ฟังก์ชันการแลกเปลี่ยน Code เป็น Token ที่สมบูรณ์
- ฟังก์ชันการดึงข้อมูลโปรไฟล์ผู้ใช้งาน (Profile API)
- ระบบจัดการ Token (Refresh Token & Introspection)
- เอกสารการทดสอบการเชื่อมต่อ (UAT)
ระยะเวลาดำเนินการ
- Refresh Token มีอายุการใช้งาน 60 วัน
- Access Token มีอายุการใช้งานตามที่ระบุใน Response (เช่น 86400 วินาที)
คุณสมบัติผู้เสนอราคา
- Eligibility Requirements: ต้องเป็นหน่วยงานหรือผู้พัฒนาระบบที่ลงทะเบียน Client ID และได้รับ Secret Key จาก Provider ID แล้ว
- Technical Capabilities: มีความเชี่ยวชาญในการพัฒนา Web/Mobile Application และเข้าใจโปรโตคอล OAuth 2.0
- Personnel: ทีมพัฒนาระบบที่มีความเข้าใจด้านความปลอดภัยสารสนเทศ (Security) และการจัดการ API
เกณฑ์การพิจารณา
- ความถูกต้องของการเชื่อมต่อตาม Sequence Diagram ที่กำหนด
- ความปลอดภัยในการจัดเก็บและใช้งาน Client Secret
- ความสามารถในการจัดการ Error Code ต่างๆ ตามที่ระบุในคู่มือ
- ความครบถ้วนของข้อมูลที่ได้รับจาก API Profile
ข้อกำหนดทางเทคนิค
- Protocol: OAuth 2.0
- Authentication: Basic Authentication (Base64 encoded Client ID:Secret Key)
- Data Format: JSON
- API Endpoints: /v1/oauth2/authorize, /v1/oauth2/token, /api/v1/services/profile, /v1/oauth2/introspect
- Security: รองรับการตรวจสอบผ่าน Public Key และการทำ Token Introspection
เงื่อนไขสัญญา
- การใช้งาน API ต้องเป็นไปตามสิทธิ์ที่ได้รับอนุมัติจาก Provider ID
- ห้ามเปิดเผย Client Secret ต่อสาธารณะ
- ต้องจัดการ Error Code 401, 403, 500, 503 ตามแนวทางที่กำหนด
คำถามที่พบบ่อย (FAQ)
- Q: Refresh Token มีอายุการใช้งานนานเท่าใด? A: 60 วัน
- Q: หากได้รับ Error 401 ในการเรียก Profile API ต้องทำอย่างไร? A: ตรวจสอบความถูกต้องของ Access Token หรือ Client ID/Secret Key
- Q: สามารถดึงข้อมูลเลขบัตรประชาชนได้หรือไม่? A: ได้ หาก Client ID ของท่านได้รับสิทธิ์ในการเข้าถึง scope: cid
- Q: การทำ Basic Authentication ต้องใช้รูปแบบใด? A: “Basic " + Base64(client_id:client_secret)
- Q: หากต้องการดึงข้อมูลตำแหน่งงาน ต้องระบุพารามิเตอร์ใด? A: ระบุ position_type=1 ใน API Profile Request
- Q: ข้อมูลที่ได้รับจาก API Profile เป็นภาษาใดบ้าง? A: มีทั้งภาษาไทยและภาษาอังกฤษ
- Q: ทำไมถึงได้รับ Error 400 Invalid redirect uri? A: Redirect URI ที่ส่งมาไม่ตรงกับที่ลงทะเบียนไว้กับ Provider ID
- Q: API ใดใช้สำหรับตรวจสอบสถานะของ Token? A: /v1/oauth2/introspect
- Q: ข้อมูล organization.hcode9 คืออะไร? A: คือรหัส hcode9 ของหน่วยบริการ
- Q: หากเซิร์ฟเวอร์ปลายทางมีปัญหา (503) ควรดำเนินการอย่างไร? A: ให้ลองติดต่อผู้ดูแลระบบหรือเว้นระยะเวลาการเรียกใช้งาน
เอกสารขอบเขตงาน (TOR) ฉบับเต็ม
คู่มือการเชื่อมต่อระบบ
ด้วย OAuth ของ Provider
26 พฤษภาคม 2568
API URL
UAT (สําหรับทดสอบ)
PRD (สําหรับใช้งานจริง)
https://uat-provider.id.th
https://provider.id.th
ขั้นตอนการเชื่อมต่อ
Resource Owner (User)
Sequence Diagram OAuth Provider ID
- เข้าสู่ระบบด้วย Provider ID
3rd Party
Provider ID - Authentication Request luua /authorize โดยแนบ client id, redirect uri, response type-code และ scope
- ตอบกลับหน้าจอสําหรับเข้าสู่ระบบด้วย Provider ID
- ยืนยันตัวตน และอนุญาตให้เข้าถึงข้อมูลตามที่ร้องขอ
- redirect กลับไปที่ redirect uri พร้อม Authorization Code
- Token Request ไปยัง /taken พร้อมใช้ Authorization Code ที่ได้รับ เพื่อขอ Access Token
โดยแนบ grant type=authorization code, code, redirect uri และใช้ Basic authentication client id, client secret - ตอบกลับ Access Token
- เข้าสู่ระบบด้วย Provider ID สําเร็จ
- สร้างปุ่ม Login with Provider ID
เพิ่มปุ่ม Login with Provider ID บน Web Application หรือ Mobile Application ของคุณ - แนบลิงก์ Authentication Request
กําหนดให้ปุ่ม Login นําผู้ใช้ไปยังหน้าลงชื่อเข้าใช้ของ Provider ID โดยใช้ URL ในรูปแบบต่อไปนี้
{ProviderID-URL}/v1/o auth2/authorize?client_id={client_id}& response_type=code&redirect_uri={redirect_uri}&scope={
scope} - การดาเนินการหลังจากผู้ใช้เข้าสู่ระบบสําเร็จ
เมื่อผู้ใช้เข้าสู่ระบบสําเร็จ ระบบจะ redirect กลับไปที่ Redirect URL ที่ระบุไว้
URL ที่ส่งกลับมาจะมี Authorization Code แนบมากับพารามิเตอร์
4
การจัดการ Authorization Code ใน Frontend
Frontend ต้องอ่านค่า code จาก URL ที่ได้รับ
จากนั้นต้องส่งค่า Code ไปยัง Backend เพื่อดําเนินการตรวจสอบและขอ Access Token
การตรวจสอบและแลกเปลี่ยน Code เป็น Access Token ใน Backend
Backend จะรับค่า code ที่ได้รับจาก Frontend
ส่ง Code ไปตรวจสอบกับ Provider ID ผ่าน API เพื่อแลกเปลี่ยนเป็น Access Token
API ที่ใช้สําหรับดําเนินการ
- Authentication Request
Web Application/tvobile Application ของ RP จะส่ง authentication request ด้วย HTTP GET request ไปยัง Provider ID โดย ระบุ client_id และ redirect url ที่ได้ลงทะเบียนไว้กับ Provider ID สําเร็จแล้ว
GET
Request
Request Params:
{ProviderID-URL}/v1/oauth2/authorize
พารามิเตอร์
จ่าเป็น
ประเภทข้อมูล
คําอธิบาย (Description)
(Parameters)
(Requires)
(type)
client_id
Y
string
client id ที่ได้รับหลังจากลงทะเบียนกับ Provider ID
redirect uri
Y
string
response_type
Y
string
scope
Y
string
ระบุค่า Redirect URL ที่ลงทะเบียนไว้กับ Provider ID เพื่อใช้ในการรับ
authorization code
ระบุค่าเป็น “Code” เนื่องจากเป็นการร้องขอสิทธิการเข้าถึงข้อมูล แบบ
authorization
code
ระบุขอบเขตข้อมูลที่ต้องการร้องขอสิทธิการเข้าถึง โดยเลือกระบุค่าจากข้อมูลที่ Provider ID เปิดให้ร้องขอ ดังนี้
(1) cid คือ หมายเลขประจําตัวประชาชน 13 หลัก
(2) title_th คือ คํานําหน้า ภาษาไทย
(3) title eng คือ คํานําหน้า ภาษาอังกฤษ
(4) name th คือ ชื่อ-นามสกุล ภาษาไทย
(5) name eng คือ ชื่อ-นามสกุล ภาษาอังกฤษ
(6) mobile number คือ เบอร์โทรศัพท์
(7) email คือ อีเมล
(8) organization คือ ข้อมูลหน่วยบริการ
(9) jal คือ ระดับความน่าเชื่อถือของการพิสูจน์และยืนยันตัวตน
(10) idp_permission คือ สิทธิ์ของผู้ใช้งานจากระบบ Moph Account Center
state
N
string
(11) offline access คือ การอนุญาตให้ระบบเข้าถึงข้อมูลของผู้ใช้ได้ในภายหลัง ด้วย Refresh Token โดยไม่ต้องเข้าสู่ระบบใหม่
random string ใช้ในการตรวจสอบความสัมพันธ์ระหว่าง request จาก RP กับ
response จาก server ของ Provider ID - Token Request
เมื่อ Service ของท่านได้มีการเรียกใช้งานหน้าจอ Login with Provider ID และผู้ใช้งาน กรอกข้อมูลเพื่อเข้าสู่ระบบสําเร็จแล้ว ระบบจะ
Redirect พร้อมกับ Return Code ให้ Service ของท่านผ่าน URL ท่านสามารถนํา Authorization Code ที่ได้ มาร้องขอ access token ของผู้ใช้งาน
จาก Provider ID ด้วยการส่ง HTTPS POST request ดังนี้
2.1.
API สําหรับนํา code จาก oauth เพื่อมารับ token
POST
{Provider D-URL}/v1/oauth2/token
Request
Request Header:
พารามิเตอร์ (Parameters)
จําเป็น
(Requires)
ประเภทข้อมูล (type)
Authorization
Request Body:
คําอธิบาย (Description)
Y
string
Basic authentication (“Basic” +
Base64({{(client_id}} {{client_secret}}}}
Content-type: application/x-www-form-urlencoded
พารามิเตอร์ (Parameters)
จําเป็น
(Requires)
ประเภทข้อมูล type)
คําอธิบาย (Description)
grant_type
Y
string
ระบุค่าเป็น “authorization_code”
code
Y
string
authorization code ที่ได้รับ
redirect_uri
Y
string
URI (üusinñumuñu redirect_uri 1 authentication request
Response
Response Type: application/json
{
พารามิเตอร์ (Parameters)
ประเภทข้อมูล (type)
คําอธิบาย (Description)
string
access token
token สําหรับ ยืนยันตัวตนและให้สิทธิ์การเข้าถึงระบบ
refresh_token
string
token สําหรับขอ access token ใหม่ โดย refresh_token จะมีอายุ 60
วัน
เวลาหมดอายุของ token
expires in
string
token_type
ประเภทของ token
string
scope
string
รายการ ขอบเขตของข้อมูลที่ผู้ใช้อนุญาตให้เข้าถึง
cid
string
เลขบัตรประชาชน
name th
string
ชื่อ-นามสกุล ภาษาไทย
name_eng
string
ชื่อ-นามสกุล ภาษาอังกฤษ
ตัวอย่าง Response Body
200 OK
“status”: “Success”,
“data”: {
“access_token”: “eyJ0eXAiOiJKV1QiLCJhbZJz7it0rHbj7-V/qNWTHHSJhJOknesxpP…”,
“refresh_token”: “eyJhbGciOiJSUzI1NilsInR5cC16lkp.XVCJ9 eyJleHAIOJEзNDUOM. . .“,
“expires_in”: 86400,
“token_type”: “Bearer”,
“scope”: “cid name_th name_eng”,
“cid”:“1234567890123”,
“name th”: “หมอพร้อม ทดสอบ
“name_eng”; “Moph Test”,
},
“message”: “OK”,
“message_th”: “สําเร็จ”,
}
“code”: 200
Error code
Code
message
400
The request is missing a required parameter:
400
The grant type is not supported
400
The authorization code is invalid or has expired
message_th
ไม่มีการส่ง parameter หรือ ข้อมูลนั้นๆ มายัง API
ระบบไม่รองรับ grant type ที่ dient ร้องขอ
Code oauth ไม่ถูกต้อง หรือ หมดอายุ
400
The Client ID does not match the one used in the
authorization request
dient id ไม่ตรงกันกับ oauth
400
invalid redirect uri
401
Client authentication failed
500
server error
503
service unavailable
redirect uri ไม่ถูกต้อง
dient id ไม่ถูกต้อง
เซิฟเวอร์มีปัญหา
เซิฟเวอร์ ปลายทางมีปัญหา
POST
2.2.
Request
Request Header.
API สําหรับใช้ Refresh Token เพื่อขอ Access Token ใหม่
{ProvideriD-URL}/v1/oauth2/token
พารามิเตอร์ (Parameters)
จําเป็น
(Requires)
ประเภทข้อมูล (type)
Authorization
Request Body:
คําอธิบาย (Description)
Y
string
Basic authentication (“Basic” +
Base64{{{client_id}} {{client_secret}}})
พารามิเตอร์ (Parameters)
จําเป็น
(Requirer)
ประเภทข้อมูล (type)
คําอธิบาย (Description)
grant_type
Y
string
ระบุ refresh_token
refresh_token
Y
string
ใช้ Refresh Token ที่ได้รับจาก Response ก่อนหน้า
client id
Y
string
client id ที่ได้รับหลังจากลงทะเบียนกับ Provider D
client secret
Y
string
secret key ที่ได้รับหลังจากลงทะเบียนกับ Provider D
Response
Response Type: application/json
พารามิเตอร์ (Parameters)
ประเภทข้อมูล (type)
คําอธิบาย (Description)
string
access token
token สําหรับ ยืนยันตัวตนและให้สิทธิ์การเข้าถึงระบบ
refresh_token
string
token สําหรับขอ access token ใหม่ เมื่อหมดอายุการใช้งาน
expires_in
string
เวลาหมดอายุของ token
token_type
string
ประเภทของ token
ตัวอย่าง Response Body
{
}
200 OK
“result”: “Success”,
“data”: {
},
“access_token”: “eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzl1NilsImp0aSl6ljMуODRkMjU…”,
“refresh_token”: “def50200dfb3e4576466006b1b2fa5a4f44fc56b5db0d6519a01…”,
“expires_in”: 86399,
“token_type”: “Bearer”
“message”: “OK”,
“message_th”: “anušo”,
“code”: 200
Error code
Code
message
message th
400
The request is missing a required parameter:
ไม่มีการส่งพารามิเตอร์ที่จําเป็น เช่น refresh token
400
The grant type is not supported
ระบบไม่รองรับ grant type ที่ client ร้องขอ
400
The refresh token is invalid or has expired.
refresh_token ไม่ถูกต้อง หรือ หมดอายุ
client_id หรือ client secret ไม่ถูกต้อง
400
Invalid client credentials
400
Invalid request
401
Client authentication failed
401
Invalid refresh token
พารามิเตอร์ไม่ถูกต้อง หรือ รูปแบบการส่งข้อมูลผิด
client_id หรือ client secret ไม่ผ่านการตรวจสอบสิทธิ์
refresh token ใช้ไม่ได้ หรือ ถูกเพิกถอน
403
The client is not authorized to use this refresh token.
Client ไม่มีสิทธิ์ใช้ refresh token นี้
403
The refresh token does not match the original client
refresh token ไม่ตรงกับ Client id ที่ใช้ขอครั้งแรก
500
server error
503
service unavailable
เซิฟเวอร์มีปัญหา
เซิฟเวอร์ปลายทางมีปัญหา
3.
API Profile Request
GET
API สําหรับขอข้อมูลส่วนบุคคล และข้อมูลการทํางาน จากระบบ Provider ID
{ProviderilD-URL}/api/v1/services/profile
Request
Request Header.
Content-type: application/json
Authorization: Bearer { provider access_token จาก Response ของ API ข้อที่ 2.1}}
client-id: Client-ID ที่ได้รับจากระบบ Provider ID
secret-key: Secret-key ที่ได้รับจากระบบ Provider ID
Request Params:
พารามิเตอร์ (Parameters)
จําเป็น
(Requires)
ประเภทข้อมูล (type)
คําอธิบาย (Description)
moph_center_token
N
string
moph_idp_permission
N
string
position_type
N
string
ระบุ 1 หากต้องการดึง Token จากระบบ Moph Account Center สําหรับนําไปใช้งาน หรือดึงสิทธิ์ Public Role ที่มี
การกําหนดไว้
ระบุ 1 หากต้องการดึงข้อมูล key is hr admin และ is_director จากระบบ Moph IDP สําหรับนําไปใช้งาน
ระบุ 1 หากต้องการดึงข้อมูล key position type สําหรับนํา
ไปใช้งาน
Response
Response Type: application/json
พารามิเตอร์ (Parameters)
ประเภทข้อมูล (type)
คําอธิบาย (Description)
full cid
string
เลขบัตรประชาชน 13 หลัก (ขึ้นอยู่กับสิทธิ์การใช้งานของ
Client ID นั้น ๆ
ID йu ๆ)
เป็น Identities Number ที่ระบบสร้างให้อัตโนมัติโดยแต่ละคน
(ID) ไม่ช้ากัน
account id
string
ial level
float
lal level was User
เลขบัตรประชาชนที่ Hash ด้วย SHA256
hash_cid
string
provider_id
string
ข้อมูลเลข Prowder id
title_th
string
คํานําหน้าชื่อภาษาไทย
special_title_th
string
คํานําหน้าชื่อทางการแพทย์ภาษาไทย
nanne_th
string
ชื่อและนามสกุลภาษาไทย
name_eng
string
ชื่อภาษาอังกฤษ
created_at
string
วันที่สร้างข้อมูล
title_en
string
คํานําหน้าภาษาอังกฤษ
special_title_name_en
string
คํานําหน้าชื่อทางการแพทย์ภาษาอังกฤษ
firstname th
string
ชื่อภาษาไทย
lastname th
string
นามสกุลภาษาไทย
firstname_en
string
ชื่อภาษาอังกฤษ
lastname_en
string
นามสกุลภาษาอังกฤษ
organization.business id
string
ข้อมูลเลขรหัสองค์กร
organization.position
string
ข้อมูลตําแหน่ง
organization.hcode
string
ข้อมูลรหัสโรงพยาบาล
organization.hcode9
string
รหัส hcode9 ของหน่วยบริการ
organization.code9
string
รหัส code ของหน่วยบริการ
organization.level
string
ระดับของหน่วยบริการ
organization.hname_th
string
ข้อมูลชื่อองค์กรภาษาไทย
organization.hname_eng
string ข้อมูลชื่อองค์กรภาษาอังกฤษ
organization.tax id
string
organization.license_expired_date
string
organization.expertise
string
ข้อมูลเลขที่เสียภาษี
ข้อมูลวันหมดอายุเลขใบประกอบวิชาชีพ
ข้อมูลวิชาชีพเฉพาะ
ref_code
string
ref code จาก Station
organization.moph_access_token_idp
string
MOPH-JWT
organization.moph_access_token_idp_fdh
string
MOPH-JVT (fdh) (ขึ้นอยู่กับสิทธิ์ในการขอ Token)
organization.moph_access_token_idp_pcu
string
MOPH-JWT (pcu) (ขึ้นอยู่กับสิทธิ์ในการขอ Token)
organization.is_hr_admin
string
ข้อมูลสิทธิในการจัดการหน้า adenin
organization.is_director
string
ข้อมูล
organization.address.address
string
ข้อมูลที่อยู่องค์กร
organization.address.moo
string
ข้อมูลหมู่
organization.address.building
string
ข้อมูลอาคาร
organization.address.sol
string
ข้อมูลจอย
organization.address.street
string
ข้อมูลถนน
organization.address.province
string
ข้อมูลจังหวัด
organization.address.district
string
ข้อมูลอําาเภอ
organization.address.sub_district
string
ข้อมูลตําาบล
organization.address.zip_code
string
ข้อมูลรหัสไปรษณีย์
organization.position_type
string
ข้อมูลตําาแหน่ง
ตัวอย่าง Response Body
200 OK
{
“status”: 200,
“message”: “OK”,
“data”: {
“Ial level”: 2.3
“account_id”: “544xxxxxxxxxxx5794”,
“hash cid”: “7a5635c12063210ec4cb9ea689709541a0d474890e388 ..”,
“provider_id”: “0111111111X21”,
“title th”: “une”,
“special_title_th”; “นายแพทย์”
“name_th”: “หมอพร้อม สงบสุข,
“name_eng”: “Mophrom Eng”,
“created_at”: “2024-03-20T08:39:29.000Z”,
“title_en”: null,
“special_title_en”: “DR (Male)”,
“firstname_th”: “uanšou“,
“lastname_th”: “Ajugu”,
“firstname_en”: “Mophrom”,
“lastname_en”: “Eng”,
“organization”:[
{
“business id”: “987654321098765”,
“position”: “vá”,
“affiliation”: “www”,
“license_id”: “12345”,
“hcode”: “001234500”,
“code9”: “12345”,
“hcode9”: “AB0012345”,
“level”: “1”,
“hname_th”: “nunââñas¬”,
“hname_eng”: “Provincial Public Ha Office”,
“tax id”: “0123456789123”,
“license_expired_date”: null,
“expertise”; “สูติศาสตร์และนรีเวชวิทยา”,
“moph_station_ref_code”: null,
“address”: {
}
}
},
“address”, “อาคารหมอพร้อม
“moo”: null,
“building”: null,
“soi”: null,
“street”: null,
“province”: “uuxys”,
“district”: “เมืองนนทบุรี”,
“sub_district”: “nanmužių“,
“zip_code”: “11000”
“is_hr_admin”: true,
“is_director”: true,
“moph_access_token_idp”: “eyJhbGciOiJSUzUxMiIsInR5cC16lkp.XVCJ9.eyJzdW ..”,
“moph_access_token_idp_fdh”: “eyJhbGciOiJSUzUxMiIsInR5cC16lkp.XVCJ9 ey…”,
“moph_access_token_idp_pcu”: null
“position_type”: “umná”
}, …
]
Error code
Code
Message
Description
400
The requested parameter can not used.
lulйssy access_token,Client-ID o Secret-Key
401
access token is invalid
access_token ไม่ถูกต้อง
ไม่พบ client_id secret key ในระบบ หรือไม่ตรงกัน
ไม่พบข้อมูล provider id
401
Authentication is required to access this resource
404
This user has no provider id
404
The requested resource was not found
ข้อมูลไม่สมบูรณ์
500
Internal Server Error
เซิฟเวอร์มีปัญหา กรุณาติดต่อผู้ดูแลระบบ
503
The service is temporarily unavailable Please try ระบบที่เชื่อมต่อมีปัญหา กรุณาติดต่อผู้ดูแลระบบ
again later.
POST
4.
API สําหรับขอ Public Key ของ Provider ID
{Provider D-URL}/api/v1/services/public-key
Request
Request Header
Content-type: application/json
client-id: Client-ID Mannixuu Provider ID
secret-key: Secret-Key unsuu Provider ID
Request Body (JSON):
พารามิเตอร์ (Parameters)
จําเป็น
ประเภทข้อมูล (type)
(Requires)
คําอธิบาย (Description)
client id
Y
string
Client-ID ที่ได้รับจากระบบ Provider ID
secret key
Y
string
Secret-key ที่ได้รับจากระบบ Provider D
Response
Response Type: plair/text
พารามิเตอร์ (Parameters)
ประเภทข้อมูล (type)
public key
ตัวอย่าง Response Body
200 OK
–BEGIN PUBLIC KEY—–
xxxxxxxxxx
string
Public Key
XX
คําอธิบาย (Description)
OpnddMRKQ5+YrduRVb0e5Ffc5FofH67 at0yq/g8ilCV//vdSi0F+4Nne1Aru
u3gyz2OP+c7NHrStA3b/FV5nHnu3zzkXiUB3sGvt5FW/xUvzEF83grkS+m7
d9A1dXskDr0xE1Blw1rv2KZJ92aV/oizsv0MPj9f6TZSwQ5zQxlvoiHozjJWZa
JKQTZYCZXVylKuvGuD/vdmNBosLOS0x2G15u UgFtlSwB/2Z0dtpaLTuwqx
XX
—–END PUBLIC KEY—–
Error code
XXXXX
Code
message
message th
401
Authentication is required to access this resource
500
Internal Server Error
Client id, Secret key luņnšas
เซิฟเวอร์มีปัญหา
POST
5.
ம்
API สําหรับตรวจสอบสถานะ Access Token
{Provider D-URL}/v1/oauth2/introspect
Request
Request Header.
พารามิเตอร์ (Parameters)
จําเป็น
(Requires)
ประเภทข้อมูล (type)
Authorization
Request Body:
คําอธิบาย (Description)
Y
string
Basic authentication (“Basic” +
Content-type: application/x-www-form-urlencoded
Base64({{client_id}}{{client_secret}}}}
พารามิเตอร์ (Parameters)
จําเป็น
(Requires)
ประเภทข้อมูล (type)
คําอธิบาย (Description)
token
Response
Response Type: plain/text
Y
string
provider_access_token on Response key
access_token
access token ของ API ข้อที่ 2.1
พารามิเตอร์ (Parameters)
ประเภทข้อมูล type)
คําอธิบาย (Description)
active
boolean
สถานะของ Token
scopes
array
Scope
ที่ได้จาก Token
sub
string
account id ที่ได้จาก Token
ตัวอย่าง Response Body
200 OK
}
}
“active”: true,
“scope”: [
“tel”, “last_name”, “birth_date”, “pic”, “title”, “Biz”, “email”, “id_card”
],
“sub”: “43549898447870”
Error code
Code
message
400
Invalid request
400
[missing parameters]: ClientPermission.ClientId,
ClientPermission.SecretKey
message_th
ไม่ได้ส่ง Basic authentication หรือ token
ไม่ได้ระบุ Client Id หรือ Secret Key
400
Invalid_request Token is required
400
400
Invalid_request Token format is invalid
Invalid_request Signature verification failed
400
Invalid request Token verification failed
403
permission denied
429
To many request
ไม่ได้ส่ง token
รูปแบบ Token ไม่ถูกต้อง
Token ไม่ถูกต้อง ไม่สามารถยืนยันลายเซ็นของ Token ได้
Token ไม่ถูกต้อง ไม่สามารถยืนยัน Token ได้
Client Id หรือ Secret Key ไม่ตรงตามที่ได้ลงทะเบียนไว้
มีการร้องขอข้อมูลมากเกินไป