Client API Key — Design (Lite) Design an API key service to service that is lightweight and accurate.
ออกแบบ API key สำหรับการเรียกกัน service to service ให้เบาและยังถูกต้อง วันหนึ่งจะมีอีกทีมมาขอเรียก service ของคุณ และคุณต้องรู้ให้ได้ว่าใครเป็นคนยิงเข้ามา ตัวเลือกที่คนส่วนใหญ่หยิบมีสองขั้ว — ยัดค่าสุ่ม uuid/hash ไว้ใน env var แล้วเทียบสตริง ซึ่งใช้ได้จริงจนถึงวันที่ key หลุด หรือลาก OAuth2 มาทั้งชุด ซึ่งซับซ้อนกว่าสิ่งที่กำลังจะปกป้องหลายเท่า โพสต์นี้คือทางกลาง TL;DR ตารางเดียว 6 คอลัมน์…
The article discusses designing an API key system for secure service-to-service communication. It suggests a lightweight approach using a simple table with six columns and a function with just ten lines of code. The system stores a SHA256 hash of the key, not the key itself, and includes a timestamp for revocation. The article also advises against adding a UNIQUE constraint on the consumer column to allow for key rotation. The proposed design omits features like scopes, cache, and CLI for simplicity.
Written by urgent.news from Dev.to's report — not a translation of it. Machine-written — may contain errors; check the original before relying on it.