Skip to content

[Feat] Issue-1082 Add multi-provider OAuth login for Discord, Google, LinkedIn, GitHub - #1085

Open
Dhirenderchoudhary wants to merge 3 commits into
TeamShiksha:stagefrom
Dhirenderchoudhary:feat/issue-1082-multi-provider-oauth
Open

[Feat] Issue-1082 Add multi-provider OAuth login for Discord, Google, LinkedIn, GitHub#1085
Dhirenderchoudhary wants to merge 3 commits into
TeamShiksha:stagefrom
Dhirenderchoudhary:feat/issue-1082-multi-provider-oauth

Conversation

@Dhirenderchoudhary

@Dhirenderchoudhary Dhirenderchoudhary commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #1082

Adds multi-provider OAuth login support for Discord, Google, LinkedIn, and GitHub following the OAuth tech spec.

What this does:

  • OAuth utility layer (utils/oauth.js) — provider-agnostic module that builds authorization URLs, exchanges codes for tokens, and normalises all provider profiles into a single { id, email, username, avatar } shape
  • AuthService (services/auth.js) — 3-step user resolution: lookup by provider ID → fallback to email (links provider) → create new verified user
  • User model — added discordId, googleId, linkedinId, githubId fields (sparse + unique) and authProvider enum
  • Generic controllers — replaced per-provider routes with parameterised GET /api/auth/:provider and GET /api/auth/:provider/callback
  • CSRF protection — cryptographic state parameter stored in httpOnly cookie, validated on callback
  • MFA integration — OAuth callback checks mfaEnabled and redirects to MFA flow with ?mfaRequired=true&from=oauth
  • Frontend — OAuth buttons on sign-in form, error/MFA redirect handling in App.jsx
  • Edge cases — no-email rejection, soft-deleted account rejection, duplicate prevention via email fallback, GitHub private email fallback via /user/emails

What type of PR is this? (Check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📄 Documentation Update
  • 👨💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🛠️ CI/CD

Screenshots (if applicable)

Screenshot 2026-08-01 at 9 52 50 PM

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

@Dhirenderchoudhary is attempting to deploy a commit to the tejaskh3's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Dhirenderchoudhary
Dhirenderchoudhary marked this pull request as ready for review August 3, 2026 15:14
@Dhirenderchoudhary Dhirenderchoudhary changed the title feat(auth): add multi-provider OAuth login for Discord, Google, Linke… [Feat] Issue-1082 Add multi-provider OAuth login for Discord, Google, LinkedIn, GitHub Aug 3, 2026
@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

@Dhirenderchoudhary Dhirenderchoudhary self-assigned this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi Provider OAuth Integration

1 participant