{"_id":"@drskur/oidc-provider-solid","name":"@drskur/oidc-provider-solid","dist-tags":{"latest":"0.1.12"},"versions":{"0.1.12":{"name":"@drskur/oidc-provider-solid","version":"0.1.12","description":"OpenID Connect & OAuth2 authentication using solidjs context api as state management","main":"dist/index.cjs.js","module":"dist/index.es.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.es.js","require":"./dist/index.cjs.js"}},"repository":{"type":"git","url":"git+https://github.com/drskur/oidc-provider-solid.git"},"keywords":["oauth2","oidc","solid-component"],"author":{"name":"drskur"},"license":"MIT","bugs":{"url":"https://github.com/drskur/oidc-provider-solid/issues"},"homepage":"https://github.com/drskur/oidc-provider-solid#readme","publishConfig":{"access":"public"},"devDependencies":{"@types/node":"^25.6.0","typescript":"^6.0.3","vite":"^8.0.10","vite-plugin-dts":"^4.5.4","vite-plugin-solid":"^2.11.12"},"peerDependencies":{"oidc-client-ts":"^3.5.0","solid-js":"^1.9.12"},"scripts":{"build":"vite build","dev":"vite build --watch","test":"echo \"Error: no test specified\" && exit 1","publish:patch":"npm version patch && npm publish","publish:minor":"npm version minor && npm publish","publish:major":"npm version major && npm publish"},"_id":"@drskur/oidc-provider-solid@0.1.12","_integrity":"sha512-1lWgc6jQa0EUSrXSOycQCbvi+/A64EKj3iJsWg8FrG1G+Uctusc7A22nz26EGIZHawCoo/3dn/rfHJJDAHCCJA==","_resolved":"/private/var/folders/fh/qbdv8g5x2f3dbxxgxc53cnxm0000gr/T/a185eb3828e9f93ff7e8f5e8ea545834/drskur-oidc-provider-solid-0.1.12.tgz","_from":"file:drskur-oidc-provider-solid-0.1.12.tgz","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-1lWgc6jQa0EUSrXSOycQCbvi+/A64EKj3iJsWg8FrG1G+Uctusc7A22nz26EGIZHawCoo/3dn/rfHJJDAHCCJA==","shasum":"2cbef3bb8969bf03319d702e7ecc0dd49f4b7588","tarball":"https://registry.npmjs.org/@drskur/oidc-provider-solid/-/oidc-provider-solid-0.1.12.tgz","fileCount":25,"unpackedSize":47070,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC8C+D5TXv3sveGEp+xcFLa6jehpHPbzB8XYixHBYD4owIgau6Jd3v+IX5cBNQhSIF0nID2VmuHd7TrEmdx/YvcjKU="}]},"_npmUser":{"name":"drskur","email":"drskur@me.com"},"directories":{},"maintainers":[{"name":"drskur","email":"drskur@me.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/oidc-provider-solid_0.1.12_1777443287957_0.9337665939676363"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-29T06:14:47.883Z","0.1.12":"2026-04-29T06:14:48.093Z","modified":"2026-04-29T06:14:48.263Z"},"maintainers":[{"name":"drskur","email":"drskur@me.com"}],"description":"OpenID Connect & OAuth2 authentication using solidjs context api as state management","homepage":"https://github.com/drskur/oidc-provider-solid#readme","keywords":["oauth2","oidc","solid-component"],"repository":{"type":"git","url":"git+https://github.com/drskur/oidc-provider-solid.git"},"author":{"name":"drskur"},"bugs":{"url":"https://github.com/drskur/oidc-provider-solid/issues"},"license":"MIT","readme":"# @drskur/oidc-provider-solid\n\nOpenID Connect & OAuth2 authentication provider for SolidJS applications.\n\n## Installation\n\n```bash\nnpm install @drskur/oidc-provider-solid oidc-client-ts\n```\n\n## Usage\n\n### 1. Wrap your app with AuthProvider\n\n```tsx\nimport { render } from \"solid-js/web\";\nimport { AuthProvider } from \"@drskur/oidc-provider-solid\";\nimport App from \"./App\";\n\nconst config = {\n  authority: \"https://your-oidc-provider.com\",\n  client_id: \"your-client-id\",\n  redirect_uri: \"http://localhost:3000/callback\",\n  response_type: \"code\",\n  scope: \"openid profile email\",\n};\n\n// Optional: Custom loading component\nconst LoadingSpinner = () => (\n  <div style={{ display: \"flex\", justify-content: \"center\", align-items: \"center\", height: \"100vh\" }}>\n    <div>Loading...</div>\n  </div>\n);\n\nrender(\n  () => (\n    <AuthProvider config={config} loadingComponent={<LoadingSpinner />}>\n      <App />\n    </AuthProvider>\n  ),\n  document.getElementById(\"root\")!\n);\n```\n\n### 2. Use the useAuth hook in your components\n\n```tsx\nimport { useAuth } from \"@drskur/oidc-provider-solid\";\n\nfunction MyComponent() {\n  const { user, isAuthenticated, isLoading, login, logout } = useAuth();\n\n  if (isLoading()) {\n    return <div>Loading...</div>;\n  }\n\n  return (\n    <div>\n      {isAuthenticated() ? (\n        <>\n          <h1>Welcome, {user()?.profile.name}!</h1>\n          <p>Email: {user()?.profile.email}</p>\n          <button onClick={logout}>Logout</button>\n        </>\n      ) : (\n        <button onClick={login}>Login with OIDC</button>\n      )}\n    </div>\n  );\n}\n```\n\n## API Reference\n\n### AuthProvider\n\nThe main provider component that manages authentication state and provides loading state management.\n\n**Props:**\n- `config: UserManagerSettings` - OIDC client configuration\n  - `authority`: Your OIDC provider URL\n  - `client_id`: Your application's client ID\n  - `redirect_uri`: Callback URL after authentication\n  - `response_type`: OAuth2 response type (typically \"code\")\n  - `scope`: Requested scopes (e.g., \"openid profile email\")\n- `children: JSX.Element` - Child components to be wrapped with auth context\n- `loadingComponent?: JSX.Element` - Optional component to show during authentication loading state (prevents flickering of previous content)\n\n### useAuth Hook\n\nReturns the authentication context with the following properties:\n\n- `user: () => User | null` - Current authenticated user\n- `isAuthenticated: () => boolean` - Whether the user is authenticated\n- `isLoading: () => boolean` - Loading state during authentication\n- `login: () => Promise<void>` - Initiate login flow\n- `logout: () => Promise<void>` - Logout the user\n\n### AuthService\n\nLow-level service for direct OIDC operations:\n\n```tsx\nimport { AuthService } from \"@drskur/oidc-provider-solid\";\n\nconst authService = new AuthService(config);\n\n// Check if current URL is a callback\nif (authService.isCallbackUrl()) {\n  const user = await authService.handleCallback();\n}\n\n// Get current user\nconst user = await authService.getUser();\n\n// Check authentication\nconst isAuth = await authService.isAuthenticated();\n\n// Login\nawait authService.redirectToLogin();\n\n// Logout\nawait authService.logout();\n```\n\n## Configuration Examples\n\n### Basic Configuration\n\n```typescript\nconst config = {\n  authority: \"https://accounts.google.com\",\n  client_id: \"your-google-client-id\",\n  redirect_uri: \"http://localhost:3000/callback\",\n  response_type: \"code\",\n  scope: \"openid profile email\",\n};\n```\n\n### Advanced Configuration\n\n```typescript\nconst config = {\n  authority: \"https://your-oidc-provider.com\",\n  client_id: \"your-client-id\",\n  redirect_uri: \"http://localhost:3000/callback\",\n  post_logout_redirect_uri: \"http://localhost:3000/\",\n  response_type: \"code\",\n  scope: \"openid profile email offline_access\",\n  automaticSilentRenew: true,\n  silentRequestTimeout: 10000,\n  loadUserInfo: true,\n};\n```\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.","readmeFilename":"README.md","_rev":"1-3ccb4e575ead2eac350294f45d8e4254"}