fix: start GitHub connect with auth header#81
Conversation
🚀 PR Received SuccessfullyHello @saurabhhhcodes, Thank you for taking the initiative to contribute to this project. Please ensure that your PR follows all project guidelines properly before requesting review.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR converts the GitHub account connection flow from a direct browser redirect to a protected endpoint into a two-step authenticated API request. Frontend calls a new backend endpoint to obtain a GitHub authorization URL, then redirects to it, fixing the 401 error that occurred when authorization headers were lost during direct navigation. ChangesGitHub Account Connection Flow
Sequence DiagramsequenceDiagram
participant Browser
participant GitHubCard
participant AuthController
participant GitHub
Browser->>GitHubCard: User clicks "Connect GitHub Account"
GitHubCard->>AuthController: POST /auth/github/connect/start (authenticated)
AuthController->>AuthController: Generate GitHub auth URL<br/>using req.user._id and redirectPath
AuthController->>GitHubCard: Return { authUrl }
GitHubCard->>Browser: window.location.href = authUrl
Browser->>GitHub: Navigate to GitHub consent screen
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
bro ,the issue was assigned to me :) i dont think u should have done this |
|
Thanks for pointing that out, and sorry for stepping into work that may already have been assigned to you. I picked this up from the open issue/bug context while trying to fix the GitHub connect flow, but I do not want to block your assigned contribution. The PR is small and focused, so I’ll leave it for the maintainers to decide whether it is useful to merge, close, or let you take the fix forward in your own branch. I’m okay with whichever path keeps the project workflow clean. |
Fixes #79.
What changed
POST /auth/github/connect/startendpoint that returns a GitHub authorization URL as JSON.Validation
node --check server/modules/auth/controller.jsnode --check server/modules/auth/routes.jscd frontend && ./node_modules/.bin/eslint src/pages/AccountCenterPage.jsxgit diff --checkNote:
cd frontend && ./node_modules/.bin/vite buildis blocked locally by the installed Rolldown native binding failing macOS code-signing/native optional dependency loading, before app code compiles.Suggested labels for GSSoC:
gssoc:approved,level:intermediate,quality:clean,type:bug.Summary by CodeRabbit
Release Notes
New Features
Bug Fixes