feat: connect Next.js frontend to ASP.NET Core backend with CORS and OAuth#28
Merged
feat: connect Next.js frontend to ASP.NET Core backend with CORS and OAuth#28
Conversation
…auth.ts, env examples Co-authored-by: jaseel0 <225665919+jaseel0@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add connection setup between GitQuest frontend and backend
Connect Next.js frontend to ASP.NET Core backend: CORS, OAuth, typed API client
Mar 17, 2026
jaseel0
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wires up the GitQuest frontend and backend end-to-end: CORS policy, GitHub OAuth callback, HttpOnly JWT cookie storage, and a typed fetch wrapper for all API endpoints.
Backend
AllowedOrigins[]in config (env-var overridable viaAllowedOrigins__0=https://...); addsAllowCredentials(); throws at startup in production if origins are still set to localhostAuthControllernow also handlesPOST /api/auth/githubalongside the existinggithub-loginrouteFrontend
lib/api.ts— typedApiResponse<T>fetch wrapper; no thrown exceptions; covers all five endpoints (loginWithGitHub,discoverIssues,claimIssue,getMyQuests,submitQuest)lib/auth.ts— JWT stored in HttpOnly cookie (server-side only); non-sensitive user info in a separate readable cookie for client components; helpers for set/clear/readapp/api/auth/callback/github/route.ts— OAuth code → backend exchange → HttpOnly cookie → redirect to/discover; error messages are sanitized before surfacing to the userapp/api/auth/logout/route.ts— clears both cookies server-sidenext.config.mjs— exposesNEXT_PUBLIC_API_BASE_URL(fallback:http://localhost:5198)Environment variable docs
frontend/.env.example—NEXT_PUBLIC_API_BASE_URL,NEXT_PUBLIC_GITHUB_CLIENT_IDBackend/.env.example— connection string, JWT settings, GitHub OAuth, CORS origins using ASP.NET Core's__separator syntaxWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fonts.googleapis.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/GitQuest/GitQuest/frontend/node_modules/.bin/next build(dns block)If you need me to access, download, or install something from one of these locations, you can either:
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.