{"id":13595082,"url":"https://github.com/sidebase/nuxt-auth","last_synced_at":"2026-02-06T17:01:19.186Z","repository":{"id":62423149,"uuid":"556315910","full_name":"sidebase/nuxt-auth","owner":"sidebase","description":"Authentication built for Nuxt 3! Easily add authentication via OAuth providers, credentials or Email Magic URLs!","archived":false,"fork":false,"pushed_at":"2025-04-24T13:37:24.000Z","size":15626,"stargazers_count":1441,"open_issues_count":83,"forks_count":177,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-10T04:04:03.501Z","etag":null,"topics":["authentication","local","nuxt","refresh","session","typescript","users"],"latest_commit_sha":null,"homepage":"https://auth.sidebase.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sidebase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["sidebase"]}},"created_at":"2022-10-23T15:19:47.000Z","updated_at":"2025-05-10T03:35:56.000Z","dependencies_parsed_at":"2023-10-15T22:42:58.755Z","dependency_job_id":"5b7a69fa-1162-4f5b-8c48-8809d1c9e36a","html_url":"https://github.com/sidebase/nuxt-auth","commit_stats":{"total_commits":366,"total_committers":88,"mean_commits":4.159090909090909,"dds":0.6065573770491803,"last_synced_commit":"a0704470583c5fea47c26c14b8673f8bb6a39a5f"},"previous_names":[],"tags_count":71,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidebase%2Fnuxt-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidebase%2Fnuxt-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidebase%2Fnuxt-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidebase%2Fnuxt-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sidebase","download_url":"https://codeload.github.com/sidebase/nuxt-auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253545455,"owners_count":21925398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","local","nuxt","refresh","session","typescript","users"],"created_at":"2024-08-01T16:01:43.664Z","updated_at":"2026-02-06T17:01:19.177Z","avatar_url":"https://github.com/sidebase.png","language":"TypeScript","readme":"![@sidebase/nuxt-auth banner](.github/nuxt-auth.jpg)\n\n# @sidebase/nuxt-auth\n\n\u003c!-- Badges Start --\u003e\n\u003cp\u003e\n  \u003ca href=\"https://npmjs.com/package/@sidebase/nuxt-auth\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@sidebase/nuxt-auth.svg?style=flat-square\u0026colorA=202128\u0026colorB=36936A\" alt=\"Version\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://npmjs.com/package/@sidebase/nuxt-auth\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/@sidebase/nuxt-auth.svg?style=flat-square\u0026colorA=202128\u0026colorB=36936A\" alt=\"Downloads\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/sidebase/nuxt-auth/stargazers\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/sidebase/nuxt-auth.svg?style=flat-square\u0026colorA=202128\u0026colorB=36936A\" alt=\"Downloads\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/sidebase/nuxt-auth/blob/main/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/sidebase/nuxt-auth.svg?style=flat-square\u0026colorA=202128\u0026colorB=36936A\" alt=\"License\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://auth.sidebase.io\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Docs-202128?style=flat-square\u0026logo=gitbook\u0026logoColor=DDDDD4\" alt=\"Docs\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://x.com/sidebase_io\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Follow_us-202128?style=flat-square\u0026logo=X\u0026logoColor=DDDDD4\" alt=\"Follow us on X\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.gg/NDDgQkcv3s\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Join_our_Discord-202128?style=flat-square\u0026logo=discord\u0026logoColor=DDDDD4\" alt=\"Join our Discord\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003c!-- Badges End --\u003e\n\n\u003e Authentication built for Nuxt 3+! Easily add authentication via OAuth providers, credentials or Email Magic URLs!\n\n## Quick Start\n\n```sh\nnpx nuxi@latest module add sidebase-auth\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eOr install manually\u003c/summary\u003e\n\n  #### 1. Install the package as a dev dependency\n\n  ```sh\n  npm i -D @sidebase/nuxt-auth\n\n  pnpm i -D @sidebase/nuxt-auth\n\n  yarn add --dev @sidebase/nuxt-auth\n  ```\n\n  #### 2. Add the modules to your `nuxt.config.ts`\n\n  ```ts\n  export default defineNuxtConfig({\n    modules: ['@sidebase/nuxt-auth']\n  })\n  ```\n\u003c/details\u003e\n\nThen visit the [Quick Start documentation](https://auth.sidebase.io/guide/getting-started/introduction) to continue the configuration of your app!\n\n## Features\n\n`@sidebase/nuxt-auth` is a library with the goal of supporting authentication for any universal Nuxt 3+ application. At the moment two providers are supported:\n- [`authjs`](https://auth.sidebase.io/guide/authjs/quick-start): for non-static apps that want to use [Auth.js / NextAuth.js](https://github.com/nextauthjs/next-auth) to offer the reliability \u0026 convenience of a 23k star library to the Nuxt 3+ ecosystem with a native developer experience (DX)\n- [`local`](https://auth.sidebase.io/guide/local/quick-start): for static pages that rely on an external backend with a credential flow for authentication. The Local Provider also supports refresh tokens since `v0.9.0`. Read more [here](https://auth.sidebase.io/upgrade/version-0.9.0).\n\nYou can find a full list of our features, as well as which provider supports each feature [on our docs](https://auth.sidebase.io/guide/getting-started/choose-provider).\n\n### Authentication providers:\n- OAuth (e.g., Github, Google, Twitter, Azure, ...)\n- Custom OAuth (write it yourself)\n- Credentials (password + username)\n- Email Magic URLs\n\n### Application Side Session Managment using [`useAuth`](https://auth.sidebase.io/guide/application-side/session-access#useauth-composable)\n- Session fetching with `status`, `data` and `lastRefreshedAt`\n- Methods to `getSession`, `getCsrfToken`, `getProviders`, `signIn` and `signOut`\n- Full TypeScript support for all methods and properties\n\n### Application protection\n- Application-side middleware protection for the [full application](https://auth.sidebase.io/guide/application-side/protecting-pages#global-middleware) or [specific pages](https://auth.sidebase.io/guide/application-side/protecting-pages#local-middleware)\n- Server-side [middleware](https://auth.sidebase.io/guide/authjs/server-side/session-access#server-middleware) and [endpoint protection](https://auth.sidebase.io/guide/authjs/server-side/session-access#endpoint-protection)\n\n### Advanced features for session life-cycle management:\n- Pre-built and [customizable refresh behaviour](https://auth.sidebase.io/guide/application-side/configuration#sessionrefresh)\n  - Refresh the session periodically\n  - Refresh the session on tab-refocus\n  - One time session fetch on page load, afterwards for specific actions (e.g., on navigation)\n- Completly configure the Refresh behaviour of your application using the [`RefreshHandler`](https://auth.sidebase.io/guide/application-side/configuration#refreshhandler)\n\n### Server Side utilities\n- Session access using [`getServerSession`](https://auth.sidebase.io/guide/authjs/server-side/session-access)\n- JWT Token access using [`getToken`](https://auth.sidebase.io/guide/authjs/server-side/jwt-access)\n- Server-side [middleware](https://auth.sidebase.io/guide/authjs/server-side/session-access#server-middleware) and [endpoint protection](https://auth.sidebase.io/guide/authjs/server-side/session-access#endpoint-protection)\n\n## Demo Page\n\nWant to get a preview of what `@sidebase/nuxt-auth` has to offer? Visit the [`nuxt-auth` demo page here](https://nuxt-auth-example.sidebase.io/). Peak into the [demo source-code here](https://github.com/sidebase/nuxt-auth-example).\n\n## Development\n\nThis project uses `pnpm` for development.\n\n- Run `pnpm dev:prepare` to generate type stubs.\n- Use `pnpm dev` inside a [module playground directory](#module-playground) to start a playground in development mode.\n- Run `pnpm lint` to run eslint\n- Run `pnpm typecheck` to run typescheck via tsc\n- Run `pnpm publish --access public` to publish\n- Run `pnpm publish --access public --tag next` to publish a pre-release\n\n### Module Playground\n\nThis module also has it's own playground:\n\n```sh\n\u003e git clone https://github.com/sidebase/nuxt-auth\n\n\u003e cd nuxt-auth\n\n\u003e cd playground-[PROVIDER]\n\n\u003e pnpm i\n\n\u003e pnpm dev:prepare\n\n\u003e pnpm dev\n```\n\n#### Additional playground commands\n\n- Run `pnpm dev:prepare` to generate type stubs.\n- Run `pnpm dev` to start the playground.\n- Run `pnpm test:e2e` to run the end-to-end tests.\n- Run `pnpm lint` to run eslint\n- Run `pnpm typecheck` to run typescheck via tsc\n\n#### Testing different Providers\n\nWe have one playground per provider:\n- [`authjs`](./playground-authjs)\n- [`local`](./playground-local)\n\n##### How to test static Nuxt 3+ apps?\n\nTo test static Nuxt 3+ apps we want to run a static frontend and a separate backend that will take over authentication:\n1. `playground-local/nuxt.config.ts`: Add `baseURL: 'http://localhost:3001'` to the `auth`-config\n2. Start the static frontend:\n    ```sh\n    cd playground-local\n\n    pnpm generate\n\n    pnpm start\n    ```\n3. Start the authentication backend (we use a second instance of the same nuxt3 app):\n    ```sh\n    cd playground-local\n\n    pnpm dev\n\n    # A second Nuxt app should now be running on http://localhost:3001.\n    # We use this purely for authentication\n    ```\n4.  Visit [http://localhost:3000](http://localhost:3000) -\u003e this should open the static application. Performing any auth-related actions, the app should send requests to the backend running on port `3001`\n\n## Contributing\n\nThank you to everyone who has contributed to this project by writing issues or opening pull requests. Your efforts help us improve and grow. If you are interested in contributing, please take a moment to review our [Contributing Guidelines](.github/CONTRIBUTING.md). We appreciate your support and look forward to your contributions!\n\n## Acknowledgments\n\n`@sidebase/nuxt-auth` is supported by all of our amazing contributors and the [Nuxt 3+ team](https://nuxters.nuxt.com/)!\n\n\u003ca href=\"https://github.com/sidebase/nuxt-auth/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=sidebase/nuxt-auth\" /\u003e\n\u003c/a\u003e\n","funding_links":["https://github.com/sponsors/sidebase"],"categories":["TypeScript","Relying Parties (RP) Libraries"],"sub_categories":["JavaScript"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidebase%2Fnuxt-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidebase%2Fnuxt-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidebase%2Fnuxt-auth/lists"}