-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Summary
solid-client-authn-browser receives the OAuth authorization code after redirect but does not complete the token exchange. The library stores the codeVerifier in localStorage but never exchanges the code for tokens.
Environment
- solid-client-authn-browser: 2.3.0 (via solid-logic 4.0.1)
- Browser: Chrome 131
- Server: Custom Solid server with oidc-provider
- Context: Mashlib data browser
Steps to Reproduce
- Load mashlib in browser
- Click "Sign In"
- Complete login at IdP
- Redirect back to app with
?code=...&state=...in URL
Expected Behavior
Library should:
- Detect the auth code in URL
- Retrieve
codeVerifierfrom localStorage (solidClientAuthenticationUser:*keys) - POST to token endpoint with PKCE exchange
- Store tokens and set
session.info.isLoggedIn = true
Actual Behavior
- Auth code is in URL
codeVerifierexists in localStorage undersolidClientAuthenticationUser:*key- Token exchange never happens
session.info.isLoggedInremainsfalse- No network request to
/idp/tokenendpoint
localStorage State After Redirect
{
"solidClientAuthenticationUser:default": {
"clientId": "client_xxx",
"codeVerifier": "xxx",
"redirectUrl": "http://example.com/",
"issuer": "http://example.com/"
}
}Workaround
Manual token exchange in solid-logic that:
- Captures auth code at module load (before library processes it)
- Reads session data from
solidClientAuthenticationUser:*localStorage keys - POSTs to
/idp/tokenwith PKCE parameters - Patches
window.fetchto add Bearer token
Code Location
The issue appears to be in handleIncomingRedirect() - it's called but doesn't trigger the token exchange even though all required data is present.
Related
This may be related to timing issues where the library cleans up URL parameters before handleIncomingRedirect is called, or session state management issues.
Metadata
Metadata
Assignees
Labels
No labels