Skip to content

Fall back to anonymous public reads when the GitHub proxy 401s - #79

Merged
super3 merged 1 commit into
mainfrom
claude/github-auth-401-errors-cva4ao
Jul 2, 2026
Merged

Fall back to anonymous public reads when the GitHub proxy 401s#79
super3 merged 1 commit into
mainfrom
claude/github-auth-401-errors-cva4ao

Conversation

@super3

@super3 super3 commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Problem

Signed-in users whose GitHub access can't be used by the Clerk proxy — no connected GitHub account, or a token that can't reach the repo — got a 401/403 from /api/github and the board came up empty. Every issue load failed, spamming the console with:

dashban-production.up.railway.app/api/github/repos/super3/dashban/issues?state=open  401
❌ Failed to load GitHub issues: Error: GitHub authorization failed: 401

Issue lists are public, so a failed authenticated read has no reason to leave the board blank.

Fix

  • loadGitHubIssues now retries the read anonymously against api.github.com when the proxy returns an auth error (a 401/403 that isn't a genuine rate limit), so public issues still load even when the signed-in user's GitHub access can't be used by the proxy.
  • The actionable "reconnect your GitHub access" message is now shown only when even the anonymous fallback fails (e.g. a private repo), instead of on any proxy auth error.
  • buildGitHubRequest gains an { anonymous: true } option to force the direct public GitHub path regardless of sign-in state; this drives the retry. Genuine rate limits (403 with x-ratelimit-remaining: 0) are still detected and reported as rate limits, and are not retried.

Testing

  • npm test — 975 passed.
  • npm run test:coveragegithub-api.js and github-auth.js remain at 100% statements/branches/functions/lines.
  • Updated the two proxy-401/403 tests to assert the new fallback behavior and added a test for the "anonymous fallback also fails → surface auth error" path, plus a buildGitHubRequest test for the { anonymous: true } option.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NP24pkQzfsrcNsr12s99qa


Generated by Claude Code

Signed-in users whose GitHub access can't be used by the Clerk proxy
(no connected GitHub account, or a token that can't reach the repo) got
a 401/403 from /api/github and the board came up empty — every issue
load failed with "GitHub authorization failed: 401" in the console.

Issue lists are public, so there's no reason a failed authenticated read
should leave the board blank. loadGitHubIssues now retries the read
anonymously against api.github.com when the proxy returns an auth error
(401/403 that isn't a genuine rate limit), so public issues still load.
The actionable "reconnect your GitHub access" message is now only shown
when even the anonymous fallback fails (e.g. a private repo).

buildGitHubRequest gains an { anonymous: true } option to force the
direct public path regardless of sign-in state, used to drive the retry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NP24pkQzfsrcNsr12s99qa
@railway-app
railway-app Bot temporarily deployed to dashban / dashban-pr-79 July 2, 2026 13:21 Destroyed
@super3
super3 merged commit b6748a4 into main Jul 2, 2026
2 checks passed
@super3
super3 deleted the claude/github-auth-401-errors-cva4ao branch July 2, 2026 13:28
@super3 super3 added the archive label Jul 2, 2026 — with Dashban
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants