Skip to content

feat(auth): add GitHub OAuth authentication support (#489)#553

Open
MeghPatel-007 wants to merge 2 commits into
UTKARSHH20:mainfrom
MeghPatel-007:feat/github-auth-489
Open

feat(auth): add GitHub OAuth authentication support (#489)#553
MeghPatel-007 wants to merge 2 commits into
UTKARSHH20:mainfrom
MeghPatel-007:feat/github-auth-489

Conversation

@MeghPatel-007

Copy link
Copy Markdown

Summary

This PR adds GitHub OAuth authentication support to the application, allowing users to sign in using their GitHub account in addition to the existing email/password and Google authentication methods.

Changes Made

Frontend

  • Added Continue with GitHub button to login page
  • Preserved existing authentication UI and responsive layout
  • Configured GitHub OAuth redirect flow
  • Added environment-based GitHub client configuration

Backend

  • Implemented GitHub OAuth authentication flow
  • Added GitHub authorization redirect endpoint
  • Added GitHub callback endpoint
  • Integrated access token exchange with GitHub OAuth API
  • Retrieved authenticated user profile and verified email
  • Added account linking logic for existing users
  • Created password-less GitHub accounts for first-time users
  • Generated authentication cookie after successful login

Authentication Flow

  1. User clicks Continue with GitHub
  2. User is redirected to GitHub OAuth authorization
  3. GitHub redirects back with authorization code
  4. Backend exchanges code for access token
  5. Backend fetches GitHub profile and verified email
  6. User account is created or linked
  7. Session cookie is generated
  8. User is redirected back into the application

Environment Variables

Frontend:

VITE_GITHUB_CLIENT_ID=

Backend:

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
CLIENT_URL=
BACKEND_URL=

Acceptance Criteria

  • GitHub sign-in button visible on login page
  • OAuth authentication flow implemented
  • Existing Google authentication unaffected
  • Responsive UI preserved
  • User session persists after authentication

Testing

  • Verified GitHub authorization redirect
  • Verified callback handling
  • Verified account creation flow
  • Verified account linking for existing emails
  • Verified session cookie generation

Closes #489

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

More reviews will be available in 58 minutes. 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: 871cb16f-074b-452f-bccf-79e72a6864f6

📥 Commits

Reviewing files that changed from the base of the PR and between 48e8f3e and 6aa7dce.

⛔ Files ignored due to path filters (3)
  • backend/package-lock.json is excluded by !**/package-lock.json
  • frontend/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • README.md
  • backend/.env.example
  • backend/package.json
  • backend/src/controllers/auth.controller.js
  • backend/src/controllers/githubCallback.controller.js
  • backend/src/index.js
  • backend/src/lib/socket.js
  • backend/src/models/user.model.js
  • backend/src/routes/auth.route.js
  • frontend/.env.example
  • frontend/components/chat/Sidebar.jsx
  • frontend/package.json
  • frontend/pages/LoginPage.jsx
  • frontend/pages/SignUpPage.jsx
  • frontend/src/App.jsx
  • frontend/src/store/useAuthStore.js
  • package.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@MeghPatel-007

Copy link
Copy Markdown
Author

Hi @UTKARSHH20 ,

I’ve completed the implementation and verified the changes locally while keeping the scope limited to the linked issue.

Whenever you have time, could you please review the PR and share any feedback or requested changes? If everything looks good, I’d appreciate moving it forward.

Also, if any additional labels are required for classification/GSSoC tracking, could you please add them during review.

Thank you for your time and support 🚀

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.

feat(auth): add GitHub authentication button to login page

1 participant