X Tutup
Skip to content

fix(auth): normalize trailing slashes in auth login URLs#15874

Merged
thdxr merged 1 commit intoanomalyco:devfrom
elithrar:fix/auth-trailing-slash-normalization
Mar 3, 2026
Merged

fix(auth): normalize trailing slashes in auth login URLs#15874
thdxr merged 1 commit intoanomalyco:devfrom
elithrar:fix/auth-trailing-slash-normalization

Conversation

@elithrar
Copy link
Contributor

@elithrar elithrar commented Mar 3, 2026

Issue for this PR

Closes #15873

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

opencode auth login https://opencode.cloudflare.dev/ and opencode auth login https://opencode.cloudflare.dev store separate entries in auth.json — the URL is used as the cache key verbatim. The trailing-slash variant also produces https://opencode.cloudflare.dev//.well-known/opencode during fetch.

  • Centralize trailing-slash stripping in Auth.set and Auth.remove so all callers (CLI, server API) normalize automatically
  • Auth.set also deletes any pre-existing trailing-slash variant, cleaning up stale entries from before the fix
  • Auth.remove deletes both the raw and normalized key so logout works regardless of form
  • Callsite normalization in the CLI login handler and config loader fixes the fetch URL construction (${url}/.well-known/opencode)

How did you verify your code works?

  • Direct integration tests for Auth.set/Auth.remove normalization — no mocks, real I/O against a temp auth.json
  • Config-level regression test verifying trailing-slash keys produce correct .well-known fetch URLs
  • bun run typecheck and existing test suite pass

Screenshots / recordings

N/A — no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added contributor needs:compliance This means the issue will auto-close after 2 hours. labels Mar 3, 2026
@elithrar elithrar changed the title fix: normalize trailing slashes in auth login URLs fix(auth): normalize trailing slashes in auth login URLs Mar 3, 2026
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@elithrar elithrar force-pushed the fix/auth-trailing-slash-normalization branch from 31671d5 to ed33e38 Compare March 3, 2026 18:16
@thdxr thdxr merged commit 74ebb41 into anomalyco:dev Mar 3, 2026
9 checks passed
@elithrar elithrar deleted the fix/auth-trailing-slash-normalization branch March 3, 2026 19:09
github-actions bot pushed a commit to chrn11/opencode that referenced this pull request Mar 3, 2026
Grappeggia pushed a commit to teamslop/slopcode that referenced this pull request Mar 4, 2026
praxstack pushed a commit to praxstack/opencode that referenced this pull request Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auth(login): trailing slash in URL caches a different token

2 participants

X Tutup