changed the auth approach to session id based

This commit is contained in:
AddictionGames
2026-01-07 17:16:02 +02:00
parent 9c56757742
commit 31b0164682
9 changed files with 385 additions and 67 deletions

View File

@@ -0,0 +1,13 @@
-- Create sessions table for Bearer token authentication
CREATE TABLE IF NOT EXISTS sessions (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
session_id_hash VARCHAR(255) NOT NULL UNIQUE,
user_id BIGINT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
expires_at TIMESTAMP NOT NULL,
INDEX idx_session_hash (session_id_hash),
INDEX idx_expires_at (expires_at),
INDEX idx_user_id (user_id),
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;