Add Google/Microsoft SSO OAuth for register and sign-in (#24) #29

Merged
westfarn merged 2 commits from feature/sso-oauth-24 into master 2026-07-27 05:13:32 -07:00
Owner

Summary

  • Closes #24 (backend half)
  • Add OAuthIdentity model (provider + sub, access/refresh tokens) for SSO now and Drive reuse later (#11)
  • Endpoints: GET /api/auth/oauth/<google|microsoft>/start/ and /callback/
  • Create or link CustomUser by verified email; issue same JWT access/refresh; redirect FE to /auth/callback/
  • Document GOOGLE_OAUTH_* / MICROSOFT_OAUTH_* / OAUTH_CALLBACK_BASE_URL in .env.example and .env.prod.example
  • Expose configured providers on GET /api/public/settings/ as oauth.google / oauth.microsoft

Pair with

  • Frontend PR: chat_web_app branch feature/sso-oauth-24

Test plan

  • python manage.py test chat_backend.tests.test_oauth
  • With local Google/Microsoft client IDs set, complete start → IdP → callback → JWT redirect
  • Existing password user with same email links identity (no duplicate)
  • Unverified / missing email redirects with error code
  • Registration disabled: signup start 403; login without account → account_not_found
  • Secrets not committed; env examples only
## Summary - Closes #24 (backend half) - Add `OAuthIdentity` model (provider + `sub`, access/refresh tokens) for SSO now and Drive reuse later (#11) - Endpoints: `GET /api/auth/oauth/<google|microsoft>/start/` and `/callback/` - Create or link `CustomUser` by verified email; issue same JWT access/refresh; redirect FE to `/auth/callback/` - Document `GOOGLE_OAUTH_*` / `MICROSOFT_OAUTH_*` / `OAUTH_CALLBACK_BASE_URL` in `.env.example` and `.env.prod.example` - Expose configured providers on `GET /api/public/settings/` as `oauth.google` / `oauth.microsoft` ## Pair with - Frontend PR: `chat_web_app` branch `feature/sso-oauth-24` ## Test plan - [ ] `python manage.py test chat_backend.tests.test_oauth` - [ ] With local Google/Microsoft client IDs set, complete start → IdP → callback → JWT redirect - [ ] Existing password user with same email links identity (no duplicate) - [ ] Unverified / missing email redirects with error code - [ ] Registration disabled: signup start 403; login without account → `account_not_found` - [ ] Secrets not committed; env examples only
westfarn added 1 commit 2026-07-27 05:09:04 -07:00
Add Google/Microsoft SSO OAuth for register and sign-in (#24)
CI / test (pull_request) Failing after 7s
Unit Tests / test (pull_request) Failing after 6s
be6ff471ad
Introduce OAuthIdentity storage, start/callback endpoints, JWT handoff to
the SPA, and mocked IdP tests so Drive OAuth (#11) can reuse the same model.
westfarn force-pushed feature/sso-oauth-24 from f8c29e09bb to be6ff471ad 2026-07-27 05:09:04 -07:00 Compare
westfarn added 1 commit 2026-07-27 05:12:55 -07:00
Fix migration conflict with password-reset leaves
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 10s
bbe8055573
Renumber OAuthIdentity to 0026 after 0025_outbound_email (master already
shipped 0024_user_auth_event), and restore missing ResetUserPassword import.
westfarn merged commit acb3a51618 into master 2026-07-27 05:13:32 -07:00
westfarn deleted branch feature/sso-oauth-24 2026-07-27 05:13:33 -07:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_backend#29