Fix missing grant_type in Authress token exchange; stop guessing on exchange failures - #11
Merged
Merged
Conversation
The token exchange body never sent grant_type or client_id and used
camelCase field names, while /authentication/{id}/tokens is the one
OAuth-shaped endpoint in this SDK and expects grant_type=authorization_code,
client_id, code_verifier, redirect_uri (snake_case) — confirmed against
@authress/login's own minified source. Authress was rejecting the exchange
outright, which explains the "grant type" error on login.
Separately, the exchange's error handling assumed any sub-500 status meant
"code already redeemed" and silently treated it as a successful login
without checking whether a session actually existed, and without logging
what the failure actually was — just a guessed explanation. Now every
exchange failure is logged with its real status/body, and is only treated
as harmless once a session cookie is verifiably present; anything else
surfaces as a real error via authError instead of silently resetting to
the login screen.
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.
Summary
POST /authentication/{id}/tokens) never sentgrant_typeorclient_id, and used camelCase field names (codeVerifier,redirectUri). Cross-checked against@authress/login's own minified source: this is the one endpoint in the SDK that's OAuth-shaped and expectsgrant_type=authorization_code,client_id,code_verifier,redirect_uri(snake_case). Authress was rejecting the exchange outright — this is the source of the "grant type" error on login.ERRORlevel, and is only treated as harmless once a session cookie is verifiably present (an objective check, not a guess from the status code) — otherwise it surfaces as a real error viaauthErrorinstead of silently bouncing the user back to the login screen.Test plan
LoginScreeninstead of silently resetting to "Continue"Generated by Claude Code