Skip to content

Do not put an ID token in the authorization code redirect - #232

Open
chefboyrdave21 wants to merge 1 commit into
pdsinterop:mainfrom
smilinTux:fix/code-flow-no-front-channel-id-token
Open

chefboyrdave21 wants to merge 1 commit into
pdsinterop:mainfrom
smilinTux:fix/code-flow-no-front-channel-id-token

Conversation

@chefboyrdave21

Copy link
Copy Markdown

Problem

For response_type=code the authorize endpoint inserts 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. With the extra parameter that no longer matches and the exchange fails with invalid_request / "Invalid redirect URI". This is what @inrupt/solid-client-authn-node does, and the hosted SolidOS data browser fails the same way (400 from /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 carries code and state but no id_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-node 5.0.3 / @inrupt/solid-client 4.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

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

No deployments
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.

1 participant