{"_id":"0authkit","_rev":"3-9a6afc900d85495c2f1c3a82ee68e3bb","name":"0authkit","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"0authkit","version":"1.0.0","keywords":["oauth","oauth2","auth","authentication","google","github","sdk","pkce","typescript","browser","node"],"author":{"name":"thejamesnick"},"license":"MIT","_id":"0authkit@1.0.0","maintainers":[{"name":"thejamesnick","email":"thejamesnick@gmail.com"}],"homepage":"https://github.com/thejamesnick/0AuthKit","bugs":{"url":"https://github.com/thejamesnick/0AuthKit/issues"},"dist":{"shasum":"2bc5f7384804d092c8402eb20eec66b83fcb6f5b","tarball":"https://registry.npmjs.org/0authkit/-/0authkit-1.0.0.tgz","fileCount":38,"integrity":"sha512-0yB0+4BijqLf+aBSxCPXZ/12zrTin3kTniYhcqPMl0rYxw63/1dCtWgEy3Zyw6GY5vsULr3mzN78u2d5KdrvJw==","signatures":[{"sig":"MEUCIBtquzkE4/jwPZc3cHizqQVjELwg8+2uojxDi4TIMm8NAiEA3mZJQ49HbE3FpoEgxsqG7macEGOPljyrUHxxQ65CySg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26835},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./client":{"types":"./dist/client.d.ts","import":"./dist/client.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.js"}},"gitHead":"6ec0c3b2a04b4dd5ae99bbd2e208a383708d1b46","scripts":{"dev":"tsc --watch","test":"vitest --run --exclude \"dist/**\"","build":"tsc","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"thejamesnick","email":"thejamesnick@gmail.com"},"repository":{"url":"git+https://github.com/thejamesnick/0AuthKit.git","type":"git"},"_npmVersion":"11.8.0","description":"Add OAuth to any app in minutes. Bring your own credentials.","directories":{},"_nodeVersion":"24.13.1","_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.4","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/0authkit_1.0.0_1777122028579_0.7757088403907568","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"0authkit","version":"1.0.1","keywords":["oauth","oauth2","auth","authentication","google","github","sdk","pkce","typescript","browser","node"],"author":{"name":"thejamesnick"},"license":"MIT","_id":"0authkit@1.0.1","maintainers":[{"name":"thejamesnick","email":"thejamesnick@gmail.com"}],"homepage":"https://github.com/thejamesnick/0AuthKit","bugs":{"url":"https://github.com/thejamesnick/0AuthKit/issues"},"dist":{"shasum":"96b10f0785a58129e03e03bfe53c37e69dcc3b1a","tarball":"https://registry.npmjs.org/0authkit/-/0authkit-1.0.1.tgz","fileCount":38,"integrity":"sha512-8W8X241WbQbCHR1uDLW3Howvct/7OHiD/hDbiTBPm62nMc3MnwuwkeQrc/desHeOfvcYlXqCr8K2r+d7tzLBZQ==","signatures":[{"sig":"MEUCIBE3FnBwSkbP42EaDoAxrZUVVzFIBODjtAmtVQKRhVBgAiEAmVtRFD3zqTYgk7tV2e+FX7OqAw1358d6Stvdki2L0jw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26741},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./client":{"types":"./dist/client.d.ts","import":"./dist/client.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.js"}},"gitHead":"869afdc7f8936b3d944d7de949741618205b8ad0","scripts":{"dev":"tsc --watch","test":"vitest --run --exclude \"dist/**\"","build":"tsc","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"thejamesnick","email":"thejamesnick@gmail.com"},"repository":{"url":"git+https://github.com/thejamesnick/0AuthKit.git","type":"git"},"_npmVersion":"11.8.0","description":"Add OAuth to any app in minutes. Bring your own credentials.","directories":{},"_nodeVersion":"24.13.1","_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.4","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/0authkit_1.0.1_1777134686556_0.8613872657918651","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"0authkit","version":"1.0.2","description":"Add OAuth to any app in minutes. Bring your own credentials.","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"},"./client":{"import":"./dist/client.js","types":"./dist/client.d.ts"},"./server":{"import":"./dist/server.js","types":"./dist/server.d.ts"}},"scripts":{"build":"tsc","dev":"tsc --watch","test":"vitest --run --exclude \"dist/**\"","prepublishOnly":"npm run build && npm test"},"repository":{"type":"git","url":"git+https://github.com/thejamesnick/0AuthKit.git"},"homepage":"https://github.com/thejamesnick/0AuthKit","bugs":{"url":"https://github.com/thejamesnick/0AuthKit/issues"},"keywords":["oauth","oauth2","auth","authentication","google","github","sdk","pkce","typescript","browser","node"],"author":{"name":"thejamesnick"},"license":"MIT","engines":{"node":">=18.0.0"},"devDependencies":{"@types/node":"^20.0.0","typescript":"^5.0.0","vitest":"^4.1.4"},"gitHead":"fb834fce5b349fae4be0e47c93a62c2451d9afcf","_id":"0authkit@1.0.2","_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-96shu3a/o6TZIQzqqpvI2ZQa7xKl+BiM+x0bBW8f6ERMXYNO1gKoIDG1jSp3YQiF0CI1ynfbbxFzr1f9qNYFAQ==","shasum":"a5350e0e751fb25af711a648a549f111bfd37aef","tarball":"https://registry.npmjs.org/0authkit/-/0authkit-1.0.2.tgz","fileCount":38,"unpackedSize":27067,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDmULYua47lJZhubbafKYVkj3XL9cafUS8odEuPoKKfCQIhAMgMwPD9yLQsC89a0zugsb7SBmRm9ixZhBUQI3fL5zLi"}]},"_npmUser":{"name":"thejamesnick","email":"thejamesnick@gmail.com"},"directories":{},"maintainers":[{"name":"thejamesnick","email":"thejamesnick@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/0authkit_1.0.2_1777200046222_0.3626919845491223"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-25T13:00:28.579Z","modified":"2026-04-26T10:40:46.459Z","1.0.0":"2026-04-25T13:00:28.758Z","1.0.1":"2026-04-25T16:31:26.686Z","1.0.2":"2026-04-26T10:40:46.347Z"},"bugs":{"url":"https://github.com/thejamesnick/0AuthKit/issues"},"author":{"name":"thejamesnick"},"license":"MIT","homepage":"https://github.com/thejamesnick/0AuthKit","keywords":["oauth","oauth2","auth","authentication","google","github","sdk","pkce","typescript","browser","node"],"repository":{"type":"git","url":"git+https://github.com/thejamesnick/0AuthKit.git"},"description":"Add OAuth to any app in minutes. Bring your own credentials.","maintainers":[{"name":"thejamesnick","email":"thejamesnick@gmail.com"}],"readme":"# 0AuthKit\n\n> Add OAuth to apps fast, with minimal boilerplate.\n\n0AuthKit gives you a small TypeScript SDK for Google + GitHub OAuth flows.\n\n## Project health (honest status)\n\n- ✅ Build passes\n- ✅ Basic automated tests (core auth + callback security checks)\n- ✅ Core flow implemented: auth URL, token exchange, profile fetch\n- ✅ State validation support (pass `expectedState` in callback)\n\nSo: solid mini-hack foundation, but add tests before calling it production-grade.\n\n---\n\n## Install\n\n```bash\nnpm install 0authkit\n```\n\n---\n\n## 60-second integration (server-side)\n\n### 1) Create kit\n\n```ts\nimport { OAuthKit } from '0authkit'\n\nconst kit = new OAuthKit({\n  provider: 'google',\n  clientId: process.env.GOOGLE_CLIENT_ID!,\n  clientSecret: process.env.GOOGLE_CLIENT_SECRET!,\n  redirectUri: 'http://localhost:3000/auth/callback',\n})\n```\n\n### 2) Redirect user\n\n```ts\napp.get('/auth/google', async (req, res) => {\n  const { url, state, codeVerifier } = await kit.getAuthUrl()\n  req.session.oauthState = state\n  req.session.oauthCodeVerifier = codeVerifier\n  res.redirect(url)\n})\n```\n\n### 3) Handle callback\n\n```ts\napp.get('/auth/callback', async (req, res) => {\n  const result = await kit.handleCallback(\n    String(req.query.code),\n    String(req.query.state)\n  )\n\n  // Recommended: use server functional API for explicit state/codeVerifier checks\n  // import { handleCallback } from '0authkit/server'\n  // const result = await handleCallback({\n  //   provider: 'google',\n  //   code: String(req.query.code),\n  //   state: String(req.query.state),\n  //   expectedState: req.session.oauthState,\n  //   codeVerifier: req.session.oauthCodeVerifier,\n  //   clientId: process.env.GOOGLE_CLIENT_ID!,\n  //   clientSecret: process.env.GOOGLE_CLIENT_SECRET!,\n  //   redirectUri: 'http://localhost:3000/auth/callback',\n  // })\n\n  res.json(result.profile)\n})\n```\n\n---\n\n## Best-practice callback (recommended)\n\nUse `0authkit/server` so you can validate state and PKCE verifier explicitly.\n\n```ts\nimport { getAuthUrl, handleCallback } from '0authkit/server'\n\napp.get('/auth/google', async (req, res) => {\n  const { url, state, codeVerifier } = await getAuthUrl({\n    provider: 'google',\n    clientId: process.env.GOOGLE_CLIENT_ID!,\n    redirectUri: 'http://localhost:3000/auth/callback',\n  })\n\n  req.session.oauthState = state\n  req.session.oauthCodeVerifier = codeVerifier\n  res.redirect(url)\n})\n\napp.get('/auth/callback', async (req, res) => {\n  const result = await handleCallback({\n    provider: 'google',\n    code: String(req.query.code),\n    state: String(req.query.state),\n    expectedState: req.session.oauthState,\n    codeVerifier: req.session.oauthCodeVerifier,\n    clientId: process.env.GOOGLE_CLIENT_ID!,\n    clientSecret: process.env.GOOGLE_CLIENT_SECRET!,\n    redirectUri: 'http://localhost:3000/auth/callback',\n  })\n\n  res.json(result.profile)\n})\n```\n\n---\n\n## Entry points\n\n| Import | Use |\n|---|---|\n| `0authkit` | Class-based server API |\n| `0authkit/server` | Functional server API (`getAuthUrl`, `handleCallback`) |\n| `0authkit/client` | Client-safe `getAuthUrl` only |\n\n---\n\n## Providers\n\n| Provider | Status | PKCE |\n|---|---|---|\n| Google | ✅ | ✅ |\n| GitHub | ✅ | ❌ |\n\n---\n\n## Security notes\n\n- Keep `clientSecret` on server only.\n- Always persist + validate `state` (`expectedState`).\n- For PKCE providers, persist + reuse `codeVerifier`.\n- Use HTTPS in production.\n\n---\n\n## Output shape\n\n```ts\nresult.tokens  // { accessToken, refreshToken?, expiresIn?, tokenType, scope? }\nresult.profile // { id, email, name, avatar, raw }\n```\n\n---\n\nBuilt by [thejamesnick](https://github.com/thejamesnick)\n","readmeFilename":"README.md"}