Skip to content

feat(auth): secure Google OAuth with code exchange, rate limits, and …#78

Merged
aniebietafia merged 1 commit into
mainfrom
feat/google-oauth
May 27, 2026
Merged

feat(auth): secure Google OAuth with code exchange, rate limits, and …#78
aniebietafia merged 1 commit into
mainfrom
feat/google-oauth

Conversation

@aniebietafia
Copy link
Copy Markdown
Contributor

…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.

…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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Warning

Review limit reached

@aniebietafia, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f4f15379-cc95-4b20-a875-f84714d43e1b

📥 Commits

Reviewing files that changed from the base of the PR and between 2f225a6 and 1125982.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • .env.example
  • app/modules/auth/api_docs.md
  • app/modules/auth/router.py
  • app/modules/auth/schemas.py
  • app/modules/auth/service.py
  • tests/test_auth/test_oauth_google.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/google-oauth

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aniebietafia aniebietafia merged commit f01588c into main May 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant