inrupt / inrupt/solid-client-authn-js
Token exchange not completing after OAuth redirect in mashlib/browser context
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 77
- Forks
- 49
- Avg merge
- 18h 20m
- Merged PRs (30d)
- 32
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing handleIncomingRedirect() in the browser authentication flow and reproduce the redirect in the mashlib context. Check how the authorization code, localStorage session data, URL cleanup, and session state are handled; done means the token endpoint receives the PKCE exchange and session.info.isLoggedIn becomes true.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100