API Security: OAuth 2.0 & PKCE
มาตรฐานความปลอดภัยสำหรับการเชื่อมต่อ API ที่ใช้ในระบบ Odoo 19.0 และ Yeastar P-Series V24
🇹🇭 ภาษาไทย
OAuth 2.0
- นิยาม: มาตรฐานสำหรับการให้สิทธิ์ (Authorization) โดยที่แอปภายนอกไม่จำเป็นต้องรู้รหัสผ่านจริงของผู้ใช้
- กลไก: ใช้ Access Token เป็นใบเบิกทางในการเข้าถึงข้อมูล ซึ่งมีอายุการใช้งานจำกัด และสามารถยกเลิก (Revoke) ได้
PKCE (Proof Key for Code Exchange)
- ทำไมต้องมี: เป็นส่วนเสริมของ OAuth 2.0 เพื่อป้องกันการดักขโมย Authorization Code (โดยเฉพาะในแอปมือถือหรือ Single Page Apps)
- การทำงาน: ใช้การสร้างรหัสสุ่ม (Code Verifier) และค่าแฮช (Code Challenge) เพื่อยืนยันว่าเป็นแอปเดิมที่ขอสิทธิ์จริงๆ
- ใน Yeastar V24: เพิ่มการรองรับ PKCE เพื่อความปลอดภัยสูงสุดในการเชื่อมต่อ Linkus หรือแอปภายนอก
🇬🇧 English
OAuth 2.0 Framework
OAuth 2.0 focus on client developer simplicity while providing specific authorization flows for web applications, desktop applications, mobile phones, and living room devices.
PKCE (Pronounced “pixie”)
Proof Key for Code Exchange (RFC 7636) is an extension to the OAuth 2.0 authorization code flow. It was originally designed to secure public clients (like mobile apps) but is now recommended for all clients to prevent authorization code injection attacks.
Use Cases in this Wiki
- Odoo: Leveraging XML-RPC with UID/Key and emerging OAuth support.
- Yeastar: Transitioning to PKCE for secure authentication in firmware version 37.23.0.23 (V24.1-Beta).