{"_id":"@15jainakshat/authflow-sdk","name":"@15jainakshat/authflow-sdk","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@15jainakshat/authflow-sdk","version":"1.0.0","description":"AuthFlow SDK for authentication and user management","main":"dist/index.js","module":"dist/index.esm.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","dev":"tsc --watch","prepublishOnly":"npm run build"},"keywords":["authentication","auth","sso","jwt","sdk"],"author":"","license":"MIT","repository":{"type":"git","url":""},"publishConfig":{"access":"public"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","react-dom":"^18.0.0 || ^19.0.0"},"dependencies":{"axios":"^1.7.9"},"devDependencies":{"@types/node":"^20.19.30","@types/react":"^19.0.0","@types/react-dom":"^19.0.0","typescript":"^5.0.0"},"_id":"@15jainakshat/authflow-sdk@1.0.0","_nodeVersion":"24.1.0","_npmVersion":"11.3.0","dist":{"integrity":"sha512-FbziQLnq9zg1oyUGI8VN7whSzu6RkQFJouYAN18pPRdv9+oXfUYCZz2m3fDn2zmA43oEAn+T17Yqv504KkgcgQ==","shasum":"2fd38b68df7ab58b2fb217a0430adb1279fd555d","tarball":"https://registry.npmjs.org/@15jainakshat/authflow-sdk/-/authflow-sdk-1.0.0.tgz","fileCount":26,"unpackedSize":26289,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIE/WWwcFE+S80Dt3yW//hBM6RDkG2rGFI9Sm+PAOUrkEAiAkkrGWdqXf2NDrdROWjlse88F2L5SXAbuqNaU9JU7AqA=="}]},"_npmUser":{"name":"jainakshat3376","email":"15.jain.akshat@gmail.com"},"directories":{},"maintainers":[{"name":"jainakshat3376","email":"15.jain.akshat@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/authflow-sdk_1.0.0_1768900034759_0.6284615163946841"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-20T09:07:14.651Z","1.0.0":"2026-01-20T09:07:14.890Z","modified":"2026-01-20T09:07:15.058Z"},"maintainers":[{"name":"jainakshat3376","email":"15.jain.akshat@gmail.com"}],"description":"AuthFlow SDK for authentication and user management","keywords":["authentication","auth","sso","jwt","sdk"],"repository":{"type":"git","url":""},"license":"MIT","readme":"# @authflow/sdk\r\n\r\nAuthFlow SDK for easy authentication integration in your applications.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @authflow/sdk\r\n```\r\n\r\n## Usage\r\n\r\n### 1. Wrap your app with AuthProvider\r\n\r\n```tsx\r\nimport { AuthProvider } from '@authflow/sdk';\r\n\r\nfunction App() {\r\n  return (\r\n    <AuthProvider\r\n      config={{\r\n        apiKey: 'your-api-key-here',\r\n        baseUrl: 'https://auth.yourdomain.com', // Optional, defaults to localhost\r\n      }}\r\n    >\r\n      {/* Your app */}\r\n    </AuthProvider>\r\n  );\r\n}\r\n```\r\n\r\n### 2. Use authentication hooks\r\n\r\n```tsx\r\nimport { useAuth } from '@authflow/sdk';\r\n\r\nfunction MyComponent() {\r\n  const { user, login, logout, loading } = useAuth();\r\n\r\n  if (loading) return <div>Loading...</div>;\r\n  if (!user) return <div>Please log in</div>;\r\n\r\n  return (\r\n    <div>\r\n      <p>Welcome, {user.email}!</p>\r\n      <button onClick={logout}>Logout</button>\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n### 3. Use pre-built components\r\n\r\n```tsx\r\nimport { LoginForm, ProtectedRoute } from '@authflow/sdk';\r\n\r\nfunction LoginPage() {\r\n  return (\r\n    <div>\r\n      <LoginForm\r\n        showRegister={true}\r\n        onSuccess={() => {\r\n          // Redirect after successful login\r\n          window.location.href = '/dashboard';\r\n        }}\r\n      />\r\n    </div>\r\n  );\r\n}\r\n\r\nfunction Dashboard() {\r\n  return (\r\n    <ProtectedRoute redirectTo=\"/login\">\r\n      <div>Protected content</div>\r\n    </ProtectedRoute>\r\n  );\r\n}\r\n```\r\n\r\n### 4. Use the client directly\r\n\r\n```tsx\r\nimport { AuthFlowClient } from '@authflow/sdk';\r\n\r\nconst client = new AuthFlowClient({\r\n  apiKey: 'your-api-key',\r\n  baseUrl: 'https://auth.yourdomain.com',\r\n});\r\n\r\n// Login\r\nawait client.login({ email: 'user@example.com', password: 'password' });\r\n\r\n// Get current session\r\nconst user = await client.getSession();\r\n\r\n// Logout\r\nawait client.logout();\r\n```\r\n\r\n## API Reference\r\n\r\n### AuthProvider Props\r\n\r\n- `config.apiKey` (required): Your project API key\r\n- `config.baseUrl` (optional): Base URL of the AuthFlow API\r\n- `config.cookieDomain` (optional): Cookie domain for SSO\r\n\r\n### useAuth Hook\r\n\r\nReturns:\r\n- `user`: Current user object or null\r\n- `loading`: Boolean indicating if auth state is being checked\r\n- `login(email, password)`: Login function\r\n- `register(email, password, name?)`: Register function\r\n- `logout()`: Logout function\r\n- `refreshSession()`: Refresh current session\r\n\r\n### LoginForm Props\r\n\r\n- `onSuccess?`: Callback called after successful login/register\r\n- `showRegister?`: Show register option (default: false)\r\n- `customStyles?`: Custom CSS classes for styling\r\n\r\n### ProtectedRoute Props\r\n\r\n- `children`: Content to protect\r\n- `redirectTo?`: URL to redirect if not authenticated\r\n- `fallback?`: Component to show while loading or if not authenticated\r\n","readmeFilename":"README.md","_rev":"1-0dc05b2cb738010bdcf55fd78f626784"}