%%{init: {"theme": "base", "themeVariables": {"primaryColor": "#fabd2f", "primaryTextColor": "#282828", "primaryBorderColor": "#b57614", "lineColor": "#7c6f64", "secondaryColor": "#83a598", "tertiaryColor": "#b8bb26", "background": "#fbf1c7", "mainBkg": "#ebdbb2", "fontFamily": "Tahoma, sans-serif"}}}%% flowchart LR subgraph Era1["ยุค API Key / Simple Token"] A["API Keyระบุตัว client"] end subgraph Era2["ยุค JWT / Signed Claims"] B["Header.Payload.Signatureข้อมูลพร้อมลายเซ็น"] C["Access Tokenอายุสั้น"] end subgraph Era3["ยุค Token Rotation / Refresh Flow"] D["Refresh Tokenอายุยาว"] E["httpOnly Cookieลดการถูกอ่านด้วย JS"] end A --> B --> C --> D --> E
%%{init: {"theme": "base", "themeVariables": {"primaryColor": "#fabd2f", "primaryTextColor": "#282828", "primaryBorderColor": "#b57614", "lineColor": "#7c6f64", "secondaryColor": "#83a598", "tertiaryColor": "#b8bb26", "background": "#fbf1c7", "mainBkg": "#ebdbb2", "fontFamily": "Tahoma, sans-serif"}}}%% sequenceDiagram participant C as Client / ไคลเอนต์ participant S as Server / เซิร์ฟเวอร์ C->>S: Login with username/password S-->>C: Access Token + Refresh Cookie C->>S: API request with Access Token S-->>C: Protected data C->>S: Refresh request with httpOnly Cookie S-->>C: New Access Token