Skip to content

Require an access token when validating credentials (#10) - #14

Merged
sorenbcoding merged 2 commits into
mainfrom
fix/10-require-access-token
Nov 13, 2026
Merged

sorenbcoding merged 2 commits into
mainfrom
fix/10-require-access-token

Conversation

@sorenbcoding

Copy link
Copy Markdown
Owner

Closes #10. Same fix in the desktop app: sorenbcoding/tenant-switcher-app#17. Found in an external code review.

What changes (src/identity.ts, validateCredentials)

  • A 2xx response counts as ok only when its JSON has a non-empty string access_token. A 2xx without one (HTML sign-in page, empty JSON, 204) is unknown: "… answered HTTP 200 instead of issuing a token … A proxy or sign-in page may be in the way."
  • The request uses redirect: 'manual', so a redirect is no longer followed and becomes unknown ("redirected (HTTP 302)").
  • unknown takes the existing Switch anyway path. Nothing new appears in the UI.
  • CHANGELOG Unreleased.

Testing

  • npm run typecheck, npm run build and the brand check pass. npm test: 52 passed.
  • New tests:
    • 200 with an HTML page, {}, an empty token or null, and 204: all unknown with the proxy hint.
    • 302 is unknown, and the request asked for redirect: 'manual'.
    • The existing "posts client_credentials" test still gets ok with a token.
  • Not yet tested against the real Identity Server in Studio. That comes with the 0.4.2 test packages.

🤖 Generated with Claude Code

sorenbcoding and others added 2 commits November 13, 2026 14:26
Any 2xx response counted as valid credentials, and redirects were
followed, so a proxy or captive-portal page could pass the check and
let the switch disconnect the Robot unverified. Success now needs a
non-empty access_token, redirects are not followed, and both cases are
"could not verify" with a hint about proxies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sorenbcoding
sorenbcoding merged commit f7e934f into main Nov 13, 2026
1 check passed
@sorenbcoding
sorenbcoding deleted the fix/10-require-access-token branch November 13, 2026 13:27
sorenbcoding added a commit that referenced this pull request Nov 19, 2026
Require an access token when validating credentials (#10)
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.

Require an access token when validating credentials

1 participant