Skip to main content

Security และ authentication

CFO ใช้ OAuth 2.0 Client Credentials สำหรับ machine-to-machine integration เท่านั้น หน้าเอกสารนี้เป็น read-only และไม่มีช่องรับ credential หรือ token

ขอ token จาก server side

POST ${CFO_BASE_URL}/integrations/oauth/token
Content-Type: application/x-www-form-urlencoded
Authorization: Basic ${BASE64_CLIENT_ID_AND_SECRET}

grant_type=client_credentials

token มีอายุ 15 นาที เก็บใน memory ของ process เท่านั้น ใช้ token เดิมซ้ำจนใกล้หมดอายุ แล้ว refresh ด้วย skew เล็กน้อย เมื่อ resource ตอบ 401 ให้ล้าง token ขอใหม่ และ retry request เดิมได้เพียงหนึ่งครั้ง

Secret lifecycle

  • เก็บ client_secret ใน ERP secret store หรือไฟล์ที่ permission จำกัด
  • ห้ามบันทึก secret, access token, Authorization header หรือ cookie ลง outbox/log/evidence
  • เมื่อหมุนกุญแจ ให้แทน secret เดิมโดยไม่เปลี่ยน durable business identity
  • ถ้า token endpoint ตอบ 429 ให้รอ Retry-After และใช้ bounded backoff ห้ามวนไม่จำกัด
  • หากได้ 401 invalid_client ให้หยุดและให้ CFO operator ตรวจสถานะ ห้ามส่ง secret ผ่าน chat/email

หลักฐานส่ง support ควรมีเวลา, zone, client ID ที่ไม่ใช่ secret, correlation ID, job ID และ error code ที่ redact แล้ว