You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removed all JWT-based authentication from the attendabot admin panel, consolidating on BetterAuth (Discord OAuth) session cookies as the sole auth method. The password login form has been removed — login is now Discord-only.
6
+
7
+
## What We Did
8
+
9
+
### Backend
10
+
11
+
1.**Simplified `auth.ts` middleware** — removed `jwt` import, `getJwtSecret()`, `generateToken()`, `verifyCredentials()`, `verifyPassword()`, `getValidUsernames()`, and all instructor password logic. `authenticateToken()` now only verifies BetterAuth session cookies.
12
+
2.**Cleaned up `auth.ts` routes** — removed `POST /login` (JWT token issuance) and `GET /usernames` (password login dropdown) endpoints. Only `GET /login-config` remains.
13
+
3.**Simplified `websocket.ts`** — removed JWT token extraction/verification from WebSocket upgrade handler. Now authenticates exclusively via BetterAuth session cookies on the upgrade request.
14
+
15
+
### Frontend
16
+
17
+
1.**Stripped JWT from `client.ts`** — removed `getToken()`, `setToken()`, `clearToken()`, `isLoggedIn()`, `verifySession()`, `login()`, `getUsernames()`, `getLoginConfig()`. Renamed `clearToken()` to `clearSession()`. `fetchWithAuth()` now sends `credentials: "include"` instead of Bearer headers.
18
+
2.**Simplified `useWebSocket` hook** — removed `token` parameter entirely. Always connects without token query param; cookies are sent automatically with the upgrade request.
19
+
3.**Simplified `ServerLogs`** — removed `getToken` import, calls `useWebSocket()` with no args.
20
+
4.**Discord-only `Login` component** — removed password form, username dropdown, and related state. Only the Discord OAuth button remains.
21
+
5.**Simplified `App.tsx`** — removed all JWT session checks (`isLoggedIn`, `verifySession`, `getUsername`). Auth state is determined solely by BetterAuth `getSession()`.
22
+
23
+
### Tests
24
+
25
+
Rewrote `auth.test.ts` from 21 JWT-focused tests down to 4 BetterAuth session tests covering: no session (401), valid session, email fallback for username, and error handling.
0 commit comments