{"_id":"@convocomet/auth-astro","_rev":"2-0900b8b6e6cbe012d343e22d561f1eae","name":"@convocomet/auth-astro","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@convocomet/auth-astro","version":"1.0.0","main":"./index.ts","types":"module.d.ts","engines":{"node":">=17.4"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/nowaythatworked/auth-astro.git"},"author":{"name":"AsyncBanana","email":"jej.jackson.08@gmail.com"},"contributors":[{"name":"nowaythatworked","email":"jan.czekala99@web.de"},{"name":"Otterlord","email":"otterlord.dev@gmail.com"},{"name":"tajkirkpatrick"}],"scripts":{"format":"prettier --config .prettierrc --ignore-path .prettierignore -w  ."},"peerDependencies":{"@auth/core":"^0.13.0","astro":"^2.0.0"},"devDependencies":{"@auth/core":"^0.13.0","@types/cookie":"^0.5.2","@types/node":"^20.5.9","@types/set-cookie-parser":"^2.4.3","astro":"^3.0.8","next-auth":"^4.23.1","prettier":"^3.0.3","prettier-plugin-astro":"^0.12.0","typescript":"^5.2.2","vite":"^4.4.9"},"dependencies":{"next-auth":"^4.23.1"},"keywords":["astro","auth","authentication","integration","@auth","@auth/core","authjs","jwt","oauth","astro-auth","astro-integration"],"publishConfig":{"access":"public"},"packageManager":"pnpm@8.7.1","_id":"@convocomet/auth-astro@1.0.0","gitHead":"fc40f749aff5606ec12114f30f14157f0d7091d1","description":"This is a fork of [Auth Astro](https://github.com/nowaythatworked/auth-astro), including many fixes and new features, which was created due to a lack of maintenance in the upstream version.","bugs":{"url":"https://github.com/nowaythatworked/auth-astro/issues"},"homepage":"https://github.com/nowaythatworked/auth-astro#readme","_nodeVersion":"20.5.0","_npmVersion":"9.8.0","dist":{"integrity":"sha512-PQkD0ZcEg77TVfEwW9xEOKDrUhlDyC57+vb6CAQ5BxXkwgyetZ/cOG/16C8HbOHRMLVuxCf+CZLzjziRu1ym+Q==","shasum":"4af5c35b0bcf6657e3ff0f32ebb46111137ff5c1","tarball":"https://registry.npmjs.org/@convocomet/auth-astro/-/auth-astro-1.0.0.tgz","fileCount":14,"unpackedSize":20152,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBp7faiyvTK7wrPtwwi8gUE+wcY0im16Ta7nmDK6ikIwAiEAgQO01La8QcLJ7hD+nytPT0jsk8lERh/MYKzVp6ivRBo="}]},"_npmUser":{"name":"asyncbanana","email":"jej.jackson.08@gmail.com"},"directories":{},"maintainers":[{"name":"asyncbanana","email":"jej.jackson.08@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auth-astro_1.0.0_1693877037090_0.6024494007996852"},"_hasShrinkwrap":false},"1.0.1":{"name":"@convocomet/auth-astro","version":"1.0.1","main":"./index.ts","types":"module.d.ts","engines":{"node":">=17.4"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/nowaythatworked/auth-astro.git"},"author":{"name":"AsyncBanana","email":"jej.jackson.08@gmail.com"},"contributors":[{"name":"nowaythatworked","email":"jan.czekala99@web.de"},{"name":"Otterlord","email":"otterlord.dev@gmail.com"},{"name":"tajkirkpatrick"}],"scripts":{"format":"prettier --config .prettierrc --ignore-path .prettierignore -w  ."},"peerDependencies":{"@auth/core":"^0.13.0","astro":"^2.0.0"},"devDependencies":{"@auth/core":"^0.13.0","@types/cookie":"^0.5.2","@types/node":"^20.5.9","@types/set-cookie-parser":"^2.4.3","astro":"^3.0.8","next-auth":"^4.23.1","prettier":"^3.0.3","prettier-plugin-astro":"^0.12.0","typescript":"^5.2.2","vite":"^4.4.9"},"dependencies":{"next-auth":"^4.23.1"},"keywords":["astro","auth","authentication","integration","@auth","@auth/core","authjs","jwt","oauth","astro-auth","astro-integration"],"publishConfig":{"access":"public"},"packageManager":"pnpm@8.7.1","_id":"@convocomet/auth-astro@1.0.1","gitHead":"58922e2c612b3ef9cdeffd5590dab775cfbba702","description":"This is a fork of [Auth Astro](https://github.com/nowaythatworked/auth-astro), including many fixes and new features, which was created due to a lack of maintenance in the upstream version.","bugs":{"url":"https://github.com/nowaythatworked/auth-astro/issues"},"homepage":"https://github.com/nowaythatworked/auth-astro#readme","_nodeVersion":"20.5.0","_npmVersion":"9.8.0","dist":{"integrity":"sha512-TkOQ8k0mL9FACw2YMP+krlHwBnbMIL3SoZzX/PZiStWUVwrp3Rszt6C72kzu/cm8zOWBc1SbK2tTRXbopRewAQ==","shasum":"8f80d8b02bc6126bb8ea9c8e03bbf3aea2a95619","tarball":"https://registry.npmjs.org/@convocomet/auth-astro/-/auth-astro-1.0.1.tgz","fileCount":14,"unpackedSize":20164,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCuVWlOck97eI/yL+nBbnn7aiGdLjmuolVDhq8IkkD8WAIgZFMlGDVyaSaF7UQVV8aXjtz+x+nDX+TjrlL1clUeGW0="}]},"_npmUser":{"name":"asyncbanana","email":"jej.jackson.08@gmail.com"},"directories":{},"maintainers":[{"name":"asyncbanana","email":"jej.jackson.08@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auth-astro_1.0.1_1693877482808_0.9945994112411942"},"_hasShrinkwrap":false},"1.1.0":{"name":"@convocomet/auth-astro","version":"1.1.0","main":"./index.ts","types":"./index.ts","engines":{"node":">=17.4"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/nowaythatworked/auth-astro.git"},"author":{"name":"AsyncBanana","email":"jej.jackson.08@gmail.com"},"contributors":[{"name":"nowaythatworked","email":"jan.czekala99@web.de"},{"name":"Otterlord","email":"otterlord.dev@gmail.com"},{"name":"tajkirkpatrick"}],"scripts":{"format":"prettier --config .prettierrc --ignore-path .prettierignore -w  ."},"peerDependencies":{"@auth/core":"^0.14.0","astro":"^3.0.13"},"devDependencies":{"@auth/core":"^0.14.0","@types/cookie":"^0.5.2","@types/node":"^20.6.0","@types/set-cookie-parser":"^2.4.3","astro":"^3.0.13","next-auth":"^4.23.1","prettier":"^3.0.3","prettier-plugin-astro":"^0.12.0","typescript":"^5.2.2","vite":"^4.4.9"},"dependencies":{"next-auth":"^4.23.1"},"exports":{".":{"default":"./index.ts","types":"./index.ts"},"./components":{"default":"./components.ts","types":"./components.ts"},"./client":{"default":"./client.ts","types":"./client.ts"},"./server":{"default":"./server.ts","types":"./server.ts"}},"keywords":["astro","auth","authentication","integration","@auth","@auth/core","authjs","jwt","oauth","astro-auth","astro-integration"],"publishConfig":{"access":"public"},"packageManager":"pnpm@8.7.5","gitHead":"10cdc092a8b232205b3dae4ec3f79acfdd9e2f35","description":"This is a fork of [Auth Astro](https://github.com/nowaythatworked/auth-astro), including many fixes and new features, which was created due to a lack of maintenance in the upstream version.","bugs":{"url":"https://github.com/nowaythatworked/auth-astro/issues"},"homepage":"https://github.com/nowaythatworked/auth-astro#readme","_id":"@convocomet/auth-astro@1.1.0","_nodeVersion":"20.3.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-+KhaIYGbSQVzBGWjeTCaCLTulcnWI0IETLEs5c1BgrEudaBQFiTiJu3x5K6afM+01n8ndkyr3ZcFy3WPvVWpCg==","shasum":"3dc5d8b0abd2cbfe3f1a1b7b774dbbb52a979038","tarball":"https://registry.npmjs.org/@convocomet/auth-astro/-/auth-astro-1.1.0.tgz","fileCount":14,"unpackedSize":20338,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCw/SAfldxQkGPbw4MV4aTdxKbW5LD/FKczOkanujLXogIgd1X/cTnDgZOOLpxY6ekwVgdSpcbuCOZPzX2qWQ8htmc="}]},"_npmUser":{"name":"asyncbanana","email":"jej.jackson.08@gmail.com"},"directories":{},"maintainers":[{"name":"asyncbanana","email":"jej.jackson.08@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/auth-astro_1.1.0_1694882093761_0.8168262328642764"},"_hasShrinkwrap":false}},"time":{"created":"2023-09-05T01:23:56.967Z","1.0.0":"2023-09-05T01:23:57.276Z","modified":"2023-09-16T16:34:54.197Z","1.0.1":"2023-09-05T01:31:23.107Z","1.1.0":"2023-09-16T16:34:53.979Z"},"maintainers":[{"name":"asyncbanana","email":"jej.jackson.08@gmail.com"}],"description":"This is a fork of [Auth Astro](https://github.com/nowaythatworked/auth-astro), including many fixes and new features, which was created due to a lack of maintenance in the upstream version.","homepage":"https://github.com/nowaythatworked/auth-astro#readme","keywords":["astro","auth","authentication","integration","@auth","@auth/core","authjs","jwt","oauth","astro-auth","astro-integration"],"repository":{"type":"git","url":"git+https://github.com/nowaythatworked/auth-astro.git"},"contributors":[{"name":"nowaythatworked","email":"jan.czekala99@web.de"},{"name":"Otterlord","email":"otterlord.dev@gmail.com"},{"name":"tajkirkpatrick"}],"author":{"name":"AsyncBanana","email":"jej.jackson.08@gmail.com"},"bugs":{"url":"https://github.com/nowaythatworked/auth-astro/issues"},"license":"MIT","readme":"# Auth Astro\n\nThis is a fork of [Auth Astro](https://github.com/nowaythatworked/auth-astro), including many fixes and new features, which was created due to a lack of maintenance in the upstream version.\n\nAuth Astro is the easiest way to add Authentication to your Astro Project. It wraps the core of [Auth.js](https://authjs.dev/) into an Astro integration which automatically adds the endpoints and handles everything else.\n\n(**disclaimer**: Please don´t confuse this package with [astro-auth](https://github.com/astro-community/astro-auth))\n\n# Installation\n\nThe easiest way to get started is adding this package using the astro cli.\n\n```bash\nnpm run astro add @convocomet/auth-astro\n```\n\nThis will install the package and required peer-dependencies and add the integration to your config.\nYou can now jump to [configuration](#configuration)\n\nAlternarviely you can install the required packagages on your own.\n\n```bash\nnpm install @convocomet/auth-astro@latest @auth/core@latest\n```\n\nNext you need to [add the integration to your astro config](https://docs.astro.build/en/guides/integrations-guide/#using-integrations) by importing it and listing it in the integrations array.\n\n## Configuration\n\nCreate your [auth configuration](https://authjs.dev/getting-started/oauth-tutorial#creating-the-server-config) file in the root of your project.\n\n```ts title=\"auth.config.ts\"\nimport GitHub from '@auth/core/providers/github'\nimport { defineConfig } from '@convocomet/auth-astro'\n\nexport default defineConfig({\n\tproviders: [\n\t\tGitHub({\n\t\t\tclientId: env.GITHUB_CLIENT_ID,\n\t\t\tclientSecret: env.GITHUB_CLIENT_SECRET,\n\t\t}),\n\t],\n})\n```\n\nSome OAuth Providers request a callback URL be submitted alongside requesting a Client ID, and Client Secret. The callback URL used by the providers must be set to the following, unless you override the prefix field in the configuration:\n\n```\n[origin]/api/auth/callback/[provider]\n\n// example\n// http://localhost:3000/api/auth/callback/github\n```\n\n### Setup Environment Variables\n\nGenerate an auth secret by running `openssl rand -hex 32` in a local terminal or by visiting [generate-secret.vercel.app](https://generate-secret.vercel.app/32), copy the string, then set it as the `AUTH_SECRET` environment variable describe below.\n\nNext set the `AUTH_TRUST_HOST` environment variable to `true` for hosting providers like Cloudflare Pages or Netlify.\n\n```sh\nAUTH_SECRET=<auth-secret>\nAUTH_TRUST_HOST=true\n```\n\n#### Deploying to Vercel?\n\nSetting `AUTH_TRUST_HOST` is not needed as we also check for an active Vercel environment.\n\n### Requirements\n\n- Node version `>= 17.4`\n- Astro config set to output mode `server`\n- [SSR](https://docs.astro.build/en/guides/server-side-rendering/) enabled in your Astro project\n\nResources:\n\n- [Enabling SSR in Your Project](https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project)\n- [Adding an Adapter](https://docs.astro.build/en/guides/server-side-rendering/#adding-an-adapter)\n\n# Usage\n\nYour authentication endpoints now live under `[origin]/api/auth/[operation]`. You can change the prefix in the configuration.\n\n## Accessing your configuration\n\nIn case you need to access your auth configuration, you can always import it by\n\n```ts\nimport authConfig from 'auth:config'\n```\n\n## Sign in & Sign out\n\nAstro Auth exposes two ways to sign in and out. Inline scripts and Astro Components.\n\n### With Inline script tags\n\nThe `signIn` and `signOut` methods can be imported dynamically in an inline script.\n\n```html\n---\n---\n\n<html>\n\t<body>\n\t\t<button id=\"login\">Login</button>\n\t\t<button id=\"logout\">Logout</button>\n\n\t\t<script>\n\t\t\tconst { signIn, signOut } = await import(\"@convocomet/auth-astro/client\")\n\t\t\tdocument.querySelector(\"#login\").onclick = () => signIn(\"github\")\n\t\t\tdocument.querySelector(\"#logout\").onclick = () => signOut()\n\t\t</script>\n\t</body>\n</html>\n```\n\n### With auth-astro's Components\n\nAlternatively, you can use the `SignIn` and `SignOut` button components provided by `@convocomet/auth-astro/components` importing them into your Astro [component's script](https://docs.astro.build/en/core-concepts/astro-components/#the-component-script)\n\n```jsx\n---\nimport { SignIn, SignOut } from '@convocomet/auth-astro/components'\n---\n<html>\n  <body>\n    ...\n    <SignIn provider=\"github\" />\n    <SignOut />\n    ...\n  </body>\n</html>\n```\n\n## Fetching the session\n\nYou can fetch the session in one of two ways. The `getSession` method can be used in the component script section to fetch the session.\n\n### Within the component script section\n\n```tsx title=\"src/pages/index.astro\"\n---\nimport { getSession } from '@convocomet/auth-astro/server';\n\nconst session = await getSession(Astro.request)\n---\n{session ? (\n  <p>Welcome {session.user?.name}</p>\n) : (\n  <p>Not logged in</p>\n)}\n```\n\n### Within the Auth component\n\nAlternatively, you can use the `Auth` component to fetch the session using a render prop.\n\n```tsx title=\"src/pages/index.astro\"\n---\nimport type { Session } from '@auth/core/types';\nimport { Auth, Signin, Signout } from '@convocomet/auth-astro/components';\n---\n<Auth>\n  {(session: Session) =>\n    {session ?\n      <Signin provider=\"github\">Login</Signin>\n    :\n      <Signout>Logout</Signout>\n    }\n\n    <p>\n      {session ? `Logged in as ${session.user?.name}` : 'Not logged in'}\n    </p>\n  }\n</Auth>\n```\n\n# State of Project\n\nHopefully, the fixes contained in this project. Eventually, this should be merged into [Auth.js](https://github.com/nextauthjs/next-auth), and when that happens this package will be deprecated.\n\n# Contribution\n\nUs waiting means on the PR to be merged means, we can still add new features to the PR, so, if you miss anything feel free to open a PR or issue in this repo and we will try to add it to the official package to come.\n","readmeFilename":"README.md"}