{"_id":"@allem-sdk/auth","_rev":"4-50a7568364d1736009a07c65c22f8941","name":"@allem-sdk/auth","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@allem-sdk/auth","version":"0.1.0","keywords":["allem-sdk","react","hooks","auth","authentication","session","protected-route"],"author":{"name":"Ahmed Allem"},"license":"MIT","_id":"@allem-sdk/auth@0.1.0","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"homepage":"https://github.com/kingofmit/allem-sdk#readme","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"dist":{"shasum":"7acc8441fdf689246f3d5486148be411ecd0e9c6","tarball":"https://registry.npmjs.org/@allem-sdk/auth/-/auth-0.1.0.tgz","fileCount":8,"integrity":"sha512-ik1Oftg3+PECbQuYN97cKF770NJAuMHXTXGXWPAzlgW34GmrMUtqSACQxh3o//GE0eZxrTyJcYdVzeXpGdlXwA==","signatures":[{"sig":"MEUCIAfPnRa3H32b6ABpgwh/KNmuz3gBVo2+muInXZREcl7yAiEAgC52FXLhm8cgroFpRR4fxUHDENlWuxqNzHKgF6s4PiY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18090},"main":"./dist/index.js","_from":"file:allem-sdk-auth-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist"},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/f3a95af9cd76e402497acef124e92bc8/allem-sdk-auth-0.1.0.tgz","_integrity":"sha512-ik1Oftg3+PECbQuYN97cKF770NJAuMHXTXGXWPAzlgW34GmrMUtqSACQxh3o//GE0eZxrTyJcYdVzeXpGdlXwA==","repository":{"url":"git+https://github.com/kingofmit/allem-sdk.git","type":"git","directory":"packages/auth"},"_npmVersion":"11.12.1","description":"Authentication helpers for React — session, protected routes, social login","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.4.0","jsdom":"^25.0.0","react":"^19.0.0","vitest":"^3.0.0","react-dom":"^19.0.0","typescript":"^5.8.0","@types/react":"^19.0.0","@testing-library/react":"^16.0.0"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/auth_0.1.0_1779452651346_0.2321615983937515","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@allem-sdk/auth","version":"0.1.1","keywords":["allem-sdk","react","hooks","auth","authentication","session","protected-route"],"author":{"name":"Ahmed Allem"},"license":"MIT","_id":"@allem-sdk/auth@0.1.1","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"homepage":"https://github.com/kingofmit/allem-sdk#readme","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"dist":{"shasum":"e192ff6a057c6a6034a8fae09138af2415c11a55","tarball":"https://registry.npmjs.org/@allem-sdk/auth/-/auth-0.1.1.tgz","fileCount":8,"integrity":"sha512-vaCnI4iyTt06Udc7MbpXoEz2V7h9b5KG7A4ZqmQmX+/lDRaAhuaFNVKV3Nw2fhEk0OVpKlzLw5o4gjKwxgz46w==","signatures":[{"sig":"MEQCIETS/s+O2J+1XnqpGoQBm3siJl1FLPL5rx16ThzY/72GAiAYLHGNgZD7ozyzafCF6oxc2m84XGlo3uwEMoybZdzEKQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18088},"main":"./dist/index.js","_from":"file:allem-sdk-auth-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist"},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/3f216db857a8e36d88da06918a8d5793/allem-sdk-auth-0.1.1.tgz","_integrity":"sha512-vaCnI4iyTt06Udc7MbpXoEz2V7h9b5KG7A4ZqmQmX+/lDRaAhuaFNVKV3Nw2fhEk0OVpKlzLw5o4gjKwxgz46w==","repository":{"url":"git+https://github.com/kingofmit/allem-sdk.git","type":"git","directory":"packages/auth"},"_npmVersion":"11.12.1","description":"Authentication helpers for React — session, protected routes, social login","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.4.0","jsdom":"^25.0.0","react":"^19.0.0","vitest":"^3.0.0","react-dom":"^19.0.0","typescript":"^5.8.0","@types/react":"^19.0.0","@testing-library/react":"^16.0.0"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/auth_0.1.1_1779454889153_0.4733673424887459","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@allem-sdk/auth","version":"0.1.2","keywords":["allem-sdk","react","react-hooks","auth","authentication","session","protected-route","login","useAuth","typescript","nextjs"],"author":{"name":"Ahmed Allem"},"license":"MIT","_id":"@allem-sdk/auth@0.1.2","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"homepage":"https://github.com/kingofmit/allem-sdk#readme","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"dist":{"shasum":"cb6efa99f02dca105ba03d637f30b05a4819e3fc","tarball":"https://registry.npmjs.org/@allem-sdk/auth/-/auth-0.1.2.tgz","fileCount":8,"integrity":"sha512-MSeOOBYyxigdUUm/z5xlLizRl+xjzvPm0f9lLQkvi+5Ecjk4PWRI9D53kgK/Wd5Txv5Dg841cIrZzEpvItUU6A==","signatures":[{"sig":"MEUCIHgFnrdpnzlobkuKyunEmNI2mpAOz+da7fBU48F3aXchAiEA1QywsRO2keA9QEtrQh1IeFUsWsoHveD6DLCaYgtzEdc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18366},"main":"./dist/index.js","_from":"file:allem-sdk-auth-0.1.2.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist"},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/69b918580006c0ab71b5cad54b4baba3/allem-sdk-auth-0.1.2.tgz","_integrity":"sha512-MSeOOBYyxigdUUm/z5xlLizRl+xjzvPm0f9lLQkvi+5Ecjk4PWRI9D53kgK/Wd5Txv5Dg841cIrZzEpvItUU6A==","repository":{"url":"git+https://github.com/kingofmit/allem-sdk.git","type":"git","directory":"packages/auth"},"_npmVersion":"11.12.1","description":"React authentication hooks with session management and protected routes. Provider-agnostic adapter pattern. useAuth, useSession, ProtectedRoute.","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.4.0","jsdom":"^25.0.0","react":"^19.0.0","vitest":"^3.0.0","react-dom":"^19.0.0","typescript":"^5.8.0","@types/react":"^19.0.0","@testing-library/react":"^16.0.0"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/auth_0.1.2_1779499472093_0.7534275741335439","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@allem-sdk/auth","version":"0.1.3","description":"React authentication hooks with session management and protected routes. Provider-agnostic adapter pattern. useAuth, useSession, ProtectedRoute.","license":"MIT","author":{"name":"Ahmed Allem"},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"sideEffects":false,"devDependencies":{"@testing-library/react":"^16.0.0","@types/react":"^19.0.0","jsdom":"^25.0.0","react":"^19.0.0","react-dom":"^19.0.0","tsup":"^8.4.0","typescript":"^5.8.0","vitest":"^3.0.0"},"peerDependencies":{"react":">=18.0.0"},"repository":{"type":"git","url":"git+https://github.com/kingofmit/allem-sdk.git","directory":"packages/auth"},"keywords":["allem-sdk","react","react-hooks","auth","authentication","session","protected-route","login","useAuth","typescript","nextjs"],"publishConfig":{"access":"public"},"scripts":{"build":"tsup","dev":"tsup --watch","clean":"rm -rf dist","test":"vitest run"},"_id":"@allem-sdk/auth@0.1.3","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"homepage":"https://github.com/kingofmit/allem-sdk#readme","_integrity":"sha512-gepNw2GM0/xmmtLkGqHNwWY7VbLB7kOKJhvu3Zmv1sYMQfQZ0KN0s3ouI8T9ZsXNqcoFvxLZ0JYSYfN8TT435g==","_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/6d7775884a8ca4da3af6b6ea145bb13a/allem-sdk-auth-0.1.3.tgz","_from":"file:allem-sdk-auth-0.1.3.tgz","_nodeVersion":"26.0.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-gepNw2GM0/xmmtLkGqHNwWY7VbLB7kOKJhvu3Zmv1sYMQfQZ0KN0s3ouI8T9ZsXNqcoFvxLZ0JYSYfN8TT435g==","shasum":"50ccce11d3076fa1f20da6c82e0e4915ee239c87","tarball":"https://registry.npmjs.org/@allem-sdk/auth/-/auth-0.1.3.tgz","fileCount":8,"unpackedSize":32772,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFbi3ENjNo9YpXeXhYXlK9ZVMzxmyncWXhBz4t/rFgDZAiBRzFaGOdU7oNylw2WGuOZz0ypgm9ZpCwcGAR9dysO1GQ=="}]},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"directories":{},"maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/auth_0.1.3_1779571359631_0.1952183113925161"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-22T12:24:11.254Z","modified":"2026-05-23T21:22:39.899Z","0.1.0":"2026-05-22T12:24:11.533Z","0.1.1":"2026-05-22T13:01:29.281Z","0.1.2":"2026-05-23T01:24:32.316Z","0.1.3":"2026-05-23T21:22:39.787Z"},"bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"author":{"name":"Ahmed Allem"},"license":"MIT","homepage":"https://github.com/kingofmit/allem-sdk#readme","keywords":["allem-sdk","react","react-hooks","auth","authentication","session","protected-route","login","useAuth","typescript","nextjs"],"repository":{"type":"git","url":"git+https://github.com/kingofmit/allem-sdk.git","directory":"packages/auth"},"description":"React authentication hooks with session management and protected routes. Provider-agnostic adapter pattern. useAuth, useSession, ProtectedRoute.","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"readme":"<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/kingofmit/allem-sdk/main/.github/AllemSDK.png\" alt=\"Allem SDK\" />\n</p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@allem-sdk/auth\"><img src=\"https://img.shields.io/npm/v/@allem-sdk/auth.svg\" alt=\"npm version\" /></a>\n  <a href=\"https://github.com/kingofmit/allem-sdk/blob/main/LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\" /></a>\n  <img src=\"https://img.shields.io/badge/react-19-61dafb\" alt=\"React 19\" />\n  <img src=\"https://img.shields.io/badge/typescript-strict-blue\" alt=\"TypeScript\" />\n</p>\n\n# @allem-sdk/auth\n\nAuthentication helpers for React. Provider-agnostic via an adapter interface that works with any auth backend.\n\n## Installation\n\n```bash\nnpm install @allem-sdk/auth\n```\n\n## Usage\n\n```tsx\nimport { AuthProvider, useAuth, ProtectedRoute } from \"@allem-sdk/auth\";\n\n// Define an adapter for your auth provider\nconst myAuthAdapter = {\n  getSession: async () => {\n    const res = await fetch(\"/api/auth/session\");\n    if (!res.ok) return null;\n    return res.json();\n  },\n  signIn: async (credentials) => {\n    const res = await fetch(\"/api/auth/signin\", {\n      method: \"POST\",\n      body: JSON.stringify(credentials),\n    });\n    return res.json();\n  },\n  signOut: async () => {\n    await fetch(\"/api/auth/signout\", { method: \"POST\" });\n  },\n};\n\nfunction App() {\n  return (\n    <AuthProvider adapter={myAuthAdapter}>\n      <ProtectedRoute\n        fallback={<LoginPage />}\n        loadingFallback={<Spinner />}\n      >\n        <Dashboard />\n      </ProtectedRoute>\n    </AuthProvider>\n  );\n}\n\nfunction Dashboard() {\n  const { user, status, signOut } = useAuth();\n  return <button onClick={signOut}>Sign out, {user?.name}</button>;\n}\n```\n\n## Built-in Adapters\n\nPre-built adapters for popular auth providers — no need to write your own:\n\n```tsx\nimport { supabaseAdapter, nextAuthAdapter, clerkAdapter } from \"@allem-sdk/auth\";\n```\n\n| Adapter | Usage | Notes |\n|---------|-------|-------|\n| `supabaseAdapter(supabase)` | Pass your Supabase client | Wraps `signInWithPassword`, reads session/user |\n| `nextAuthAdapter(options?)` | `{ basePath?: string }` | Fetches from `/api/auth/session`. Works with v4/v5 |\n| `clerkAdapter(clerk)` | Pass the Clerk instance | Read-only — sign-in is handled by Clerk's `<SignIn />` |\n\n```tsx\n// Supabase\nimport { createClient } from \"@supabase/supabase-js\";\nconst supabase = createClient(url, key);\n<AuthProvider adapter={supabaseAdapter(supabase)}>\n\n// NextAuth\n<AuthProvider adapter={nextAuthAdapter()}>\n\n// Clerk\n<AuthProvider adapter={clerkAdapter(clerk)}>\n```\n\n## Exports\n\n| Export | Type | Description |\n|--------|------|-------------|\n| `AuthProvider` | Component | Context provider with automatic session management |\n| `useAuth` | Hook | Returns `user`, `status`, `isAuthenticated`, `isLoading`, `signIn`, `signOut` |\n| `useSession` | Hook | Returns `session` object and `update` function |\n| `ProtectedRoute` | Component | Renders children only when authenticated, with fallback support |\n| `supabaseAdapter` | Factory | Adapter for Supabase auth |\n| `nextAuthAdapter` | Factory | Adapter for NextAuth.js |\n| `clerkAdapter` | Factory | Adapter for Clerk |\n\n## Part of [Allem SDK](https://github.com/kingofmit/allem-sdk)\n\nThis package can be used standalone or as part of the full SDK. Install `allem-sdk` to get all packages in one install.\n\n## Support\n\nIf you find Allem SDK useful, consider supporting its development:\n\n<a href=\"https://buymeacoffee.com/kingofmit\" target=\"_blank\"><img src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" height=\"50\" /></a>\n\n## License\n\n[MIT](https://github.com/kingofmit/allem-sdk/blob/main/LICENSE) - [Ahmed Allem](https://kingallem.com)\n","readmeFilename":"README.md"}