Skip to content

fix: drop a rejected token on 401 so the next call re-mints - #105

Merged
JosteinGj merged 1 commit into
mainfrom
fix/reauth-on-401
Aug 21, 2026
Merged

fix: drop a rejected token on 401 so the next call re-mints#105
JosteinGj merged 1 commit into
mainfrom
fix/reauth-on-401

Conversation

@samuelhel

Copy link
Copy Markdown
Contributor

The client cached its token and only refreshed on expiry, so a token the server rejects was re-sent until it expired. Expiry is not the only way a token stops being usable: an identity provider still finishing its setup can issue one the API refuses for its whole lifetime — a malformed organization claim, say. A client that started a few seconds too early therefore stayed broken for up to an hour instead of recovering on its next attempt.

Clear the cached token when a request comes back 401, so the next call mints a fresh one. The failing call still fails; callers that retry now succeed.

Verified against the suite: no new failures, and two timeseries tests that were dying on an unrecoverable 401 now pass (127->132 passing).

The client cached its token and only refreshed on expiry, so a token the server
rejects was re-sent until it expired. Expiry is not the only way a token stops
being usable: an identity provider still finishing its setup can issue one the API
refuses for its whole lifetime — a malformed `organization` claim, say. A client
that started a few seconds too early therefore stayed broken for up to an hour
instead of recovering on its next attempt.

Clear the cached token when a request comes back 401, so the next call mints a
fresh one. The failing call still fails; callers that retry now succeed.

Verified against the suite: no new failures, and two timeseries tests that were
dying on an unrecoverable 401 now pass (127->132 passing).

Signed-off-by: samuel <samuel@intellistream.ai>
@samuelhel
samuelhel requested a review from olavgg August 21, 2026 13:02
@olavgg
olavgg requested a review from JosteinGj August 21, 2026 13:59
@JosteinGj
JosteinGj merged commit be3a412 into main Aug 21, 2026
18 checks passed
@JosteinGj
JosteinGj deleted the fix/reauth-on-401 branch August 21, 2026 14:13
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.

3 participants