Zero Dependencies
No runtime dependencies in the core package. Only the Web Crypto API. Works in browsers, Node.js, Deno, Bun, and Cloudflare Workers.
oidc-js is an OpenID Connect client library for JavaScript and TypeScript. It handles the full OIDC lifecycle — discovery, PKCE, token exchange, refresh, userinfo, and logout — with zero runtime dependencies and a pure-functional core that works in any JS runtime.
The library follows a functional core, imperative shell architecture: the core package (oidc-js-core) contains only pure functions that build requests and parse responses. Framework adapters compose these functions with their own HTTP and storage layers.
npm install oidc-js-reactimport { AuthProvider } from "oidc-js-react";
const config = { issuer: "https://auth.example.com", clientId: "my-app", redirectUri: "http://localhost:3000/callback", scopes: ["openid", "profile", "email"],};
function App() { return ( <AuthProvider config={config}> <MyApp /> </AuthProvider> );}Zero Dependencies
No runtime dependencies in the core package. Only the Web Crypto API. Works in browsers, Node.js, Deno, Bun, and Cloudflare Workers.
Pure Functional Core
Every core function takes data in and returns data out. No fetch, no storage, no side effects. Fully testable without mocks.
7 Framework Adapters
First-class support for React, Vue, Svelte, Angular, Solid, Preact, and Lit. Each adapter wraps the core in framework-native patterns.
PKCE by Default
Authorization Code Flow with Proof Key for Code Exchange (RFC 7636). No implicit flow, no client secrets in the browser.
Automatic Token Refresh
Auth guards detect expired tokens and silently refresh them using the refresh token. If the refresh fails, they redirect to login.
Contract-Tested
End-to-end Playwright tests against a real OIDC provider verify every flow: login, logout, refresh, deep linking, error handling, and security.
| Package | Description | Status |
|---|---|---|
oidc-js-core | Pure functions, no IO | Stable |
oidc-js | Browser client (core + fetch + sessionStorage) | Stable |
oidc-js-react | React context, hooks, and guards | Stable |
oidc-js-vue | Vue plugin, composables, and navigation guard | Stable |
oidc-js-svelte | Svelte context and components | Stable |
oidc-js-angular | Angular service, DI, and route guard | Stable |
oidc-js-solid | SolidJS signals, context, and components | Stable |
oidc-js-preact | Preact hooks and components | Stable |
oidc-js-lit | Lit reactive controllers | Stable |