Read-only mirror.
@jeswr/solid-auth-coreis developed in the jeswr/solid-sdk monorepo and published here byscripts/mirror-publish.mjssogithub:-pinned installs keep working — do not edit or PR this repo. File issues on the monorepo.
Framework-independent browser Solid authentication with WebID-first login, DPoP, silent restore, and safe fetch boundaries.
Use this package instead of copying token-provider, restore, recent-account, or React session code into an app.
Security-critical. Capture pristine fetch before authentication and keep authenticated requests restricted to explicitly allowed Solid resource origins.
npm install github:jeswr/solid-auth-core#mainInstall react only when using @jeswr/solid-auth-core/react. Requires Node.js 20.12 or newer for
tooling and a modern browser at runtime.
import { createSolidAuth } from "@jeswr/solid-auth-core";
const auth = createSolidAuth({
callbackUri: `${location.origin}/callback.html`,
clientId: `${location.origin}/clientid.jsonld`,
authFlow: { getCode },
patchGlobalFetch: true,
});
await auth.restore();
await auth.login("https://alice.example/profile/card#me");
const response = await auth.authenticatedFetch(podResourceUrl);
const publicResponse = await auth.publicFetch(foreignUrl);
await auth.logout();Call dropLiveSession() for transient failures that should preserve the durable refresh credential.
Call logout() for intentional sign-out or a definitive invalid grant.
createSolidAuth: login, restore, logout, fetches, allowed-origin re-arming, and recent accounts.WebIdDPoPTokenProvider: lower-level provider used by the factory.authenticatedFetchandpublicFetch: explicit credential boundary.reArmAllowedOrigins,rememberAccount,dropLiveSession,recentAccounts.- React:
SessionProvideranduseSolidSessionfrom@jeswr/solid-auth-core/react.
MIT © Jesse Wright