Skip to content

Authentication, JWT และ OTP

Auth Collections (เช่น users) มีระบบ Authentication พร้อมใช้ครบวงจรทันที

Method Endpoint หน้าที่
POST /api/collections/users/records สมัครสมาชิกใหม่
POST /api/collections/users/auth-with-password ล็อกอินด้วยอีเมล/รหัสผ่าน คืน JWT + ข้อมูลผู้ใช้
POST /api/collections/users/auth-refresh ต่ออายุ JWT
POST /api/collections/users/request-otp ขอรหัส OTP
POST /api/collections/users/auth-with-otp ยืนยัน OTP (จำกัดจำนวนครั้งกัน brute-force)
POST /api/collections/users/request-password-reset ขอรีเซ็ตรหัสผ่าน
POST /api/collections/users/confirm-password-reset ยืนยันรหัสผ่านใหม่
POST /api/collections/users/request-verification ส่งอีเมลยืนยันตัวตน
POST /api/collections/users/impersonate/:id สวมสิทธิ์ผู้ใช้ (เฉพาะ Superuser)

ทุก JWT ฝัง fingerprint ของ token_key (users) หรือ password_hash (superusers) เมื่อเปลี่ยนรหัสผ่านหรือหมุน token_key โทเค็นเก่าทั้งหมดจะหมดอายุทันที