Skip to content

feat: fix GitHub auth callback - #1

Merged
MekDrop merged 2 commits into
mainfrom
feat/github-auth
Apr 28, 2026
Merged

feat: fix GitHub auth callback#1
MekDrop merged 2 commits into
mainfrom
feat/github-auth

Conversation

@MekDrop

@MekDrop MekDrop commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Worker-side fixes for GitHub OAuth (pairs with git-extract.github.io#56).

Changes

src/routes/auth.js

  • Fixed error code: missing_codeno_code (aligned with frontend error map)
  • Pass state query parameter through to the SPA redirect so the frontend can verify CSRF state
  • Token and error message are now properly encodeURIComponent-encoded in the redirect URL

src/index.js

  • Added Vary: Origin response header to all CORS responses, preventing caching of incorrect CORS headers for different origins

Test plan

  • GET /auth/github/callback?code=valid_code&state=abc → 302 to ${SPA_URL}/#/auth/github?token=xxx&state=abc
  • GET /auth/github/callback (no code) → 302 to ${SPA_URL}/#/login?error=no_code
  • Invalid code → 302 to ${SPA_URL}/#/login?error=<github_error_description>
  • CORS response includes Vary: Origin

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
git-extract 433cdb6 Commit Preview URL Apr 28 2026, 06:53 PM

@MekDrop
MekDrop merged commit b33b99e into main Apr 28, 2026
2 checks passed
@MekDrop
MekDrop deleted the feat/github-auth branch April 28, 2026 20:03
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.

1 participant