You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OIDC token endpoint returns 400 'origin not allowed for client' for CDN-loaded apps #10
When Mashlib is loaded from CDN (unpkg.com), the Solid-OIDC login flow fails at the token exchange step with:
400 Bad Request
origin not allowed for client
Root Cause
The oidc-provider library validates CORS requests against the client's registered redirect URIs by default. When a web app like Mashlib is loaded from a CDN domain (unpkg.com) but makes token requests to the Solid server (jss:4000), the origin doesn't match.
Solution
Configure clientBasedCORS in the OIDC provider to allow all origins:
clientBasedCORS: ()=>true,
This is appropriate for Solid servers because:
Solid servers are public and should accept requests from any web app
Web apps can be hosted anywhere (CDNs, local development, etc.)
The Solid ecosystem relies on apps being able to authenticate against any pod
# 1. Client registration works
curl -X POST http://jss:4000/idp/reg -H "Content-Type: application/json" \
-d '{"client_name":"Test","redirect_uris":["http://localhost/cb"],...}'# → 201 Created# 2. Token generation works
curl -X POST http://jss:4000/idp/credentials -H "Content-Type: application/json" \
-d '{"username":"testoidc","password":"test123"}'# → Returns valid access_token with webid claim# 3. Token works at protected resources
curl http://jss:4000/testoidc/ -H "Authorization: Bearer <token>"# → 200 OK
Mashlib Client-side: ❌ Not completing token exchange
Both Mashlib 2.0.0 and 1.11.1 exhibit the same behavior:
Client registration ✅
Authorization request ✅
User login/consent ✅
Authorization code returned ✅
Token exchange NOT attempted ❌
The browser console shows:
Error: (via loadPrefs) Error: Can't log in: Error: Could not log in
This error occurs in solid-ui.js before any /idp/token request is made.
Root Cause
Mashlib's solid-ui library receives the authorization code but fails to exchange it for tokens. This appears to be a client-side bug in solid-ui's OAuth callback handling, not a server issue.
Workarounds
Use the /idp/credentials endpoint for programmatic access (works)
Test with a different Solid client (e.g., Penny, solid-client-authn-browser directly)
Activity
fix(idp): allow CORS for all clients on token endpoint
melvincarvalho commentedon Dec 29, 2025
Progress Update
Server-side fixes (PR #11):
clientBasedCORS: () => true- allows CORS from any origin on token endpointDPoPheader added to CORS allowed headersissparameter from authorization redirects (oidc-provider v9+ always includes RFC 9207 iss parameter)Current Status
The OIDC flow completes successfully on the server side:
However, Mashlib's client-side auth library doesn't make the token exchange request after receiving the code. The error shown is:
This appears to be a client-side issue in solid-ui/mashlib, not a server issue. The token endpoint is working correctly when tested directly.
Next Steps
melvincarvalho commentedon Dec 29, 2025
Final Investigation Results
Server-side OIDC: ✅ Working
Verified the full OIDC flow works correctly:
Mashlib Client-side: ❌ Not completing token exchange
Both Mashlib 2.0.0 and 1.11.1 exhibit the same behavior:
The browser console shows:
This error occurs in
solid-ui.jsbefore any/idp/tokenrequest is made.Root Cause
Mashlib's
solid-uilibrary receives the authorization code but fails to exchange it for tokens. This appears to be a client-side bug in solid-ui's OAuth callback handling, not a server issue.Workarounds
/idp/credentialsendpoint for programmatic access (works)PR #11 Status
The server-side fixes in PR #11 are correct and should be merged:
clientBasedCORS: () => true- CORS for token endpointDPoPheader in CORS allowed headersissparameter from redirects (RFC 9207 compatibility)The Mashlib issue is a separate client-side problem.
Fix CORS for confidential clients registered by browser apps
v0.0.26 - Fix CORS for IDP endpoints (Issue #10)
merge: MCP v2 review fixes (12 findings) into la3d/lws
[Agent: Claude] fix(lws): name/type gate moves into applyLwsWrite — t…
Merge la3d/lws-review: post-drain review round — gate choke point, ET…
[Agent: Claude] fix(lws): Control gate on sidecar writes at the apply…