Repository navigation
Docs: with X-Requested-With an ended session answers 403, not 401 - #69
Merged
Merged
Conversation
… it an ended session answers 403, not 401 Documentation only. The transport's comment advised the header so that the server would answer 401; a consumer who ended a real session saw a 401 without it and a 403 with it. An app sending the header needs unauthorizedStatuses [401, 403] and a session check in its hook. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…st for client.lists Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documentation only: no behaviour changes, and the version is not bumped.
v1.0.0-alpha.12is already tagged, so this is the first change towards alpha.13; its changelog entry sits under an "Unreleased" heading for the release pull request to rename.What was wrong
createFetchTransport's comment oncredentialsadvised a cookie-session browser app to sendX-Requested-With: XMLHttpRequest"so the server answers 401 rather than a login page".A browser-app consumer ended a real session (one product release, OIDC sign-in, the provider refusing to refresh) and saw the opposite effect:
WWW-AuthenticateBearer realm=…{"error":"Unauthorized"}X-Requested-With: XMLHttpRequestNeither was a redirect.
onUnauthorizedruns forunauthorizedStatuses, default[401], so an app that followed the advice never had its hook called when a session ended.What this changes
credentialscomment says what was seen, and what follows: without the header an ended session is a 401 and the hook runs by default; with it, setunauthorizedStatuses: [401, 403].unauthorizedStatusescomment says a hook called for a 403 should first check that the session is really gone (a one-row read withreauthorize: false), because a 403 may also be a permission denial."retry-write"comment records that a write refused with that 403 was not applied and landed once when replayed.What is not checked, and is said so
kind: "forbidden"; whether a 403 with a challenge should count as an auth failure is a separate decision, not made here.Verification
npm run verify: 289 unit tests in 36 files, all passing (the example compiles). The expiry itself rests on the consumer's evidence; it cannot be reproduced where this was written, because every request there is authenticated.Generated by Claude Code