Repository navigation
Do not put an ID token in the authorization code redirect - #232
Open
chefboyrdave21 wants to merge 1 commit into
Open
chefboyrdave21 wants to merge 1 commit into
chefboyrdave21 wants to merge 1 commit into
Conversation
For response_type=code the authorize endpoint inserted an id_token query parameter into the redirect to the client. That is not part of the code flow (the token endpoint already returns the ID token), and it breaks spec-following clients: they pass the URL they were called back on, minus code, state and iss, as redirect_uri to the token endpoint, which then no longer matches and fails with "Invalid redirect URI". This is what @inrupt/solid-client-authn-node does. Only add the ID token to the redirect for the implicit and hybrid response types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Problem
For
response_type=codethe authorize endpoint inserts anid_tokenquery parameter into the redirect to the client. That is not part of the code flow (the token endpoint already returns the ID token) and it breaks spec-following clients: they pass the URL they were called back on, minuscode,stateandiss, asredirect_urito the token endpoint. With the extra parameter that no longer matches and the exchange fails withinvalid_request/ "Invalid redirect URI". This is what@inrupt/solid-client-authn-nodedoes, and the hosted SolidOS data browser fails the same way (400from/token).Fix
Only add the ID token to the authorization redirect for the implicit and hybrid response types.
Tests
testAuthorizeWithCodeResponseTypeOmitsIdToken: the redirect for a code request carriescodeandstatebut noid_token. It fails without the fix.Verification
Verified on Nextcloud 35.0.2 (PHP 8.5) behind a reverse proxy that terminates TLS, with
@inrupt/solid-client-authn-node5.0.3 /@inrupt/solid-client4.0.0 and in a headless browser. The unit suite passes in a Nextcloud 35 container. The SolidOS data browser (mashlib) logs in, lists a private container and PATCHes its preferences file with this change; without it the token request fails with 400.🤖 Generated with Claude Code