Skip to content

feat: swap @inrupt/solid-client-authn-browser for @uvdsl/solid-oidc-client-browser#275

Open
m5x5 wants to merge 3 commits into
SolidOS:mainfrom
m5x5:feat/swap-to-uvdsl-auth
Open

feat: swap @inrupt/solid-client-authn-browser for @uvdsl/solid-oidc-client-browser#275
m5x5 wants to merge 3 commits into
SolidOS:mainfrom
m5x5:feat/swap-to-uvdsl-auth

Conversation

@m5x5
Copy link
Copy Markdown

@m5x5 m5x5 commented May 18, 2026

Summary

  • Replaces the @inrupt/solid-client-authn-browser dependency with @uvdsl/solid-oidc-client-browser (the library recommended in Switch out authentication library #274).
  • Wraps uvdsl's default Session (WebWorkerSession) in a thin Inrupt-shape adapter living in src/authSession/authSession.ts, so downstream call sites (SolidAuthnLogic, solidLogic, types, plus solid-ui's footer/header/login) keep their existing session.info/session.events/session.fetch/session.login/session.logout/session.handleIncomingRedirect surface — no consumer changes needed.
  • Uses uvdsl's SessionIDB for refresh-token + DPoP-keypair persistence and the bundled SharedWorker for background refresh + cross-tab token sharing (the intended uvdsl architecture).
  • Externalizes @uvdsl/... in the webpack config so the SharedWorker URL is constructed in the consumer bundle (mashlib) with the right publicPath — bundling inline causes webpack to bake a file:// worker URL the browser refuses to load.

Refs #274

Coordinated PRs

  • SolidOS/mashlib — webpack output config so the worker + dynamic chunks land under a known subfolder
  • SolidOS/css-mashlib — StaticAssetEntry + ACL serving that subfolder

Verified end-to-end against a local CSS pod: fresh login + multiple reloads keep the user logged in via uvdsl's RefreshTokenGrant, no ?code= redirect round-trip, no console errors.

m5x5 and others added 3 commits May 18, 2026 20:58
…lient-browser

Wraps uvdsl's default WebWorkerSession in a thin Inrupt-shape adapter
inside authSession.ts so downstream call sites (panes, solid-ui) keep
working unchanged. The SharedWorker provides background token refresh
and cross-tab token sharing — the intended uvdsl usage for web apps.

Refs SolidOS#274

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates SolidOS/solid-logic’s browser authentication from Inrupt’s @inrupt/solid-client-authn-browser to @uvdsl/solid-oidc-client-browser, introducing an adapter so existing consumers can keep using the Inrupt-shaped Session API while gaining uvdsl’s refresh/token persistence + SharedWorker-based background refresh.

Changes:

  • Replaced the Inrupt auth dependency with @uvdsl/solid-oidc-client-browser and updated internal imports to use a new adapter Session.
  • Added a thin Session adapter that preserves the session.info / session.events / session.fetch / session.login / session.logout / session.handleIncomingRedirect surface.
  • Updated build/test plumbing: webpack externalizes @uvdsl/... (to avoid broken worker URLs) and Jest stubs the uvdsl module for unit tests.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
webpack.config.mjs Externalizes @uvdsl/solid-oidc-client-browser to keep SharedWorker URL resolution correct in the consumer bundle.
test/helpers/setup.ts Mocks the uvdsl module in Jest to avoid import.meta.url/SharedWorker issues under jsdom.
src/types.ts Switches exported Session type reference to the new adapter.
src/logic/solidLogic.ts Uses the adapter Session type in logic construction.
src/authSession/authSession.ts Introduces the uvdsl-backed Inrupt-shaped Session adapter + event bridge.
src/authn/SolidAuthnLogic.ts Updates imports to use adapter Session/EVENTS.
package.json Replaces @inrupt/solid-client-authn-browser with @uvdsl/solid-oidc-client-browser.
package-lock.json Updates lockfile to reflect the dependency swap.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +20 to +24
private ensure(redirect?: string) {
return this.inner ||= new UvdslSession(
{ client_name: 'SolidOS', redirect_uris: [redirect || location.origin + location.pathname] } as any,
{ database: new SessionIDB() } as any,
)


No newline at end of file
async login(opts: { oidcIssuer: string; redirectUrl?: string }) {
const r = opts.redirectUrl || location.href
Comment on lines +17 to +18
private emit(n: string, ...a: any[]) {
this.subs[n]?.forEach(cb => { try { cb(...a) } catch (_) {} })
Comment on lines +42 to +53
async handleIncomingRedirect(opts?: { restorePreviousSession?: boolean; url?: string }) {
const url = new URL(opts?.url || location.href)
const s = this.ensure()
if (url.searchParams.has('code') && url.searchParams.has('state')) {
await s.handleRedirectFromLogin()
for (const k of ['code', 'state', 'iss']) url.searchParams.delete(k)
try { history.replaceState(null, '', url.toString()) } catch (_) {}
if (s.isActive) this.emit('login')
} else if (opts?.restorePreviousSession !== false) {
await s.restore()
if (s.isActive) this.emit('sessionRestore', url.toString())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

Switch out authentication library

3 participants