Skip to content

Link to /login/github instead of building the OAuth URL here - #6

Merged
compscidr merged 2 commits into
mainfrom
fix/631-login-github
Sep 25, 2026
Merged

compscidr merged 2 commits into
mainfrom
fix/631-login-github

Conversation

@compscidr

@compscidr compscidr commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Lands with goblogplatform/goblog#636.

Why

The GitHub button assembled GitHub's authorize URL here, with window.location concatenated straight into redirect_uri. A next containing & ended the value early and everything after it reached GitHub as further authorize parameters (goblogplatform/goblog#631).

goblog builds the URL now, so this becomes a plain anchor:

<a id="github-button" href="/login/github{{ if .next }}...?next={{ .next | urlquery }}{{ end }}">

No client_id in the page, no inline script, and the escaping is tested once in Go instead of duplicated across four theme repos.

⚠️ Merge order

goblogplatform/goblog#636 must merge and release first. /login/github does not exist until it ships; on an older goblog this link 404s and GitHub login is dead.

This is the reverse of the #624 round, where the themes went first — there they had to tolerate a goblog change, here they depend on a new route.


Also now: the ?code= block goes

goblog exchanges the code at /login itself, against a state it minted, so that block can never fire (goblogplatform/goblog#637). It was also the client half of a login CSRF: it posted whatever code appeared in the query to /api/login, which no longer exists.

Updated requirement: needs goblog with #638 (which includes #636).

🤖 Generated with Claude Code

The GitHub button used to assemble GitHub's authorize URL in an inline
script, concatenating window.location straight into redirect_uri; a
next containing & ended the value early and the rest reached GitHub as
further authorize parameters (goblog #631).

goblog builds the URL now, so this is a plain anchor at /login/github
carrying an escaped next — no client_id in the page and no inline
script.

Needs goblog with #631 for the /login/github route.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The change is small, removes inline OAuth URL construction, and correctly URL-escapes the optional next parameter in the new server-route link.

Review effort: Lite
Findings: None

What changed in this PR

Updates the theme login page to link directly to the server-provided GitHub OAuth entrypoint (/login/github) instead of assembling the GitHub authorize URL in-browser, aligning with the upstream goblog change to centralize OAuth URL construction and escaping.

Changes:

  • Replace the previously empty GitHub button + inline JS URL construction with a direct anchor to /login/github.
  • Add optional next propagation via ?next={{ .next | urlquery }} (omitted when .next is /).
File Description
templates/​login.html Switches GitHub login from client-side OAuth URL construction to a server route (/login/github) with optional next parameter forwarding.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

goblog exchanges the code at /login itself, against a state it minted,
so this block can never fire (goblog #637). It was also the client half
of the login CSRF: it posted whatever code appeared in the query to
/api/login, which no longer exists.

The email-login endpoints are posted to relatively rather than
rebuilding an origin, since the variable holding it went with the
removed block.

Needs goblog with #637.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants