feat: Supabase Anonymous Auth + JWT for chat endpoint - #2
Merged
Merged
Conversation
- Add verify_jwt() dependency to api/auth.py — validates Bearer token via supabase.auth.get_user()
- Remove user_id from ChatRequest body, read from JWT sub claim instead
- Switch session/profile/conversation repositories to admin=False (anon key)
- Update RLS policies from current_setting('app.user_id') to auth.uid()
- Add CORS_ORIGIN config for website origin
- Rewrite auth tests for JWT flow (104 tests passing)
- Replace UUID-based user_id with Supabase anonymous auth - Inject SUPABASE_URL and SUPABASE_ANON_KEY from server config - Send Authorization: Bearer <jwt> header instead of user_id in body - Auto-refresh session on 401 response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace shared-API-key + �dmin=True database access with Supabase Anonymous Auth + JWT.
Changes
How It Works