feat(auth): secure Google OAuth with code exchange, rate limits, and …#78
Conversation
…conflict checks - Implement a secure Redis-backed single-use code exchange flow for Google OAuth to prevent access token leakage in browser history/redirects. - Add a new `POST /auth/google/exchange` endpoint to exchange temporary codes for JWT access tokens and set HttpOnly refresh token cookies. - Apply rate limiting of 10 requests/minute via slowapi to the Google login and callback endpoints. - Add a verification check requiring `email_verified` to be True in the Google user profile. - Look up users by `google_id` first during resolution to handle email updates and prevent database unique constraint conflicts. - Update Google OAuth unit tests to cover the new flow. Signed-off-by: aniebietafia <aniebietafia87@gmail.com>
|
Warning Review limit reached
More reviews will be available in 49 minutes and 48 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…conflict checks
POST /auth/google/exchangeendpoint to exchange temporary codes for JWT access tokens and set HttpOnly refresh token cookies.email_verifiedto be True in the Google user profile.google_idfirst during resolution to handle email updates and prevent database unique constraint conflicts.