{"id":34847249,"url":"https://github.com/peterbud/nuxt-aegis","last_synced_at":"2026-04-28T16:33:04.461Z","repository":{"id":328227701,"uuid":"1071576001","full_name":"peterbud/nuxt-aegis","owner":"peterbud","description":"Nuxt module for authentication with JWT token generation and session management.","archived":false,"fork":false,"pushed_at":"2026-02-07T12:01:22.000Z","size":1103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-07T20:10:06.630Z","etag":null,"topics":["authentication","dx","impersonation","jwt","nuxt","nuxt-module","oauth","vue"],"latest_commit_sha":null,"homepage":"https://peterbud.github.io/nuxt-aegis/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peterbud.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/security/best-practices.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-07T14:28:46.000Z","updated_at":"2026-02-07T12:01:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/peterbud/nuxt-aegis","commit_stats":null,"previous_names":["peterbud/nuxt-aegis"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/peterbud/nuxt-aegis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterbud%2Fnuxt-aegis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterbud%2Fnuxt-aegis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterbud%2Fnuxt-aegis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterbud%2Fnuxt-aegis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterbud","download_url":"https://codeload.github.com/peterbud/nuxt-aegis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterbud%2Fnuxt-aegis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32389926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","dx","impersonation","jwt","nuxt","nuxt-module","oauth","vue"],"created_at":"2025-12-25T18:28:12.328Z","updated_at":"2026-04-28T16:33:04.456Z","avatar_url":"https://github.com/peterbud.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nuxt Aegis\n\n[![Build](https://github.com/peterbud/nuxt-aegis/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/peterbud/nuxt-aegis/actions/workflows/ci.yml)\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![License][license-src]][license-href]\n[![Nuxt][nuxt-src]][nuxt-href]\n\n**OAuth-based authentication with JWT token management for Nuxt 3/4**\n\n\u003e [!WARNING]\n\u003e **Experimental Module**: Nuxt Aegis is currently in active development and should be considered as work in progress. It is **not recommended for production use** at this time. APIs and features may change without notice.\n\nNuxt Aegis is a a Nuxt module that orchestrates the authentication flow between external identity providers (Google, GitHub, Auth0, etc.) and your application. It handles the complexity of OAuth 2.0, JWT token generation, and automatic token refresh, letting you focus on your application logic.\n\n\n## Why Nuxt Aegis?\n\nUnlike cookie-based solutions that lock your API to the browser, Nuxt Aegis uses **industry-standard JWT bearer tokens**. This means your API is ready for:\n- 📱 Mobile applications\n- 🖥️ CLI tools\n- 🌐 Third-party integrations\n- ⚡ Universal access across platforms\n\n### How It Works\n\n1. **Authentication (Identity) Provider** (e.g., Google) authenticates the user.\n2. **Nuxt Aegis** verifies the identity retrieves the user information, and issues it's own application specific JWT.\n3. **Your App** receives the JWT token and uses it for authorization.\n\nYou get full control over user data persistence while Aegis handles the security lifecycle.\n\n## ✨ Key Features\n\n- 🔐 **OAuth 2.0 \u0026 OpenID Connect** - Built-in support for Google, GitHub, Auth0, and Microsoft Entra ID.\n- 🔑 **Password Authentication** - Secure username/password flow with magic link verification.\n- 🎫 **JWT Management** - Automatic token generation, validation, and signing (HS256/RS256).\n- 🔄 **Auto-Refresh** - Seamless background token refresh with secure HTTP-only cookies.\n- 🛡️ **Route Protection** - Declarative middleware for both server API routes and client-side pages.\n- 🧪 **Mock Provider** - Built-in testing provider to simulate auth flows without external services.\n- 🎨 **Custom Claims** - Easily inject application-specific data (roles, permissions or similar) into tokens.\n- 🎭 **Impersonation** - Support for user impersonation with full audit logging\n- ⚙️ **SSR Friendly** - Works seamlessly with Nuxt's server-side rendering.\n- 🥽 **Type Safe** - Written in TypeScript with full type definitions for a great developer experience.\n\n## 🚀 Quick Start\n\n### 1. Install\n\n```bash\nnpx nuxi module add @peterbud/nuxt-aegis\n```\n\n### 2. Configure\n\nAdd the module and provider configuration to `nuxt.config.ts`:\n\n```typescript\nexport default defineNuxtConfig({\n  modules: ['@peterbud/nuxt-aegis'],\n  \n  nuxtAegis: {\n    token: {\n      secret: process.env.NUXT_AEGIS_TOKEN_SECRET!,\n    },\n    providers: {\n      google: {\n        clientId: process.env.GOOGLE_CLIENT_ID!,\n        clientSecret: process.env.GOOGLE_CLIENT_SECRET!,\n      },\n    },\n  },\n})\n```\n\n### 3. Create Auth Route\n\nCreate a server route handler to initialize the provider:\n\n```typescript\n// server/routes/auth/google.get.ts\nexport default defineOAuthGoogleEventHandler({\n  onUserInfo: (providerUserInfo, _tokens, _event) =\u003e {\n    return {\n      id: providerUserInfo.sub as string,\n      email: providerUserInfo.email,\n      name: providerUserInfo.name,\n    }\n  },\n})\n```\n\n### 4. Use in Components\n\nAccess authentication state anywhere in your app:\n\n```vue\n\u003cscript setup lang=\"ts\"\u003e\nconst { user, isLoggedIn, login, logout } = useAuth()\n\u003c/script\u003e\n\n\u003ctemplate\u003e\n  \u003cdiv v-if=\"isLoggedIn\"\u003e\n    \u003ch1\u003eWelcome, {{ user?.name }}!\u003c/h1\u003e\n    \u003cbutton @click=\"logout()\"\u003eLogout\u003c/button\u003e\n  \u003c/div\u003e\n  \u003cbutton v-else @click=\"login('google')\"\u003e\n    Login with Google\n  \u003c/button\u003e\n\u003c/template\u003e\n```\n\n## 📖 Documentation\n\nReady to dive deeper? Check out the full documentation:\n\n- **[Getting Started](https://peterbud.github.io/nuxt-aegis/getting-started/installation)** - Installation and setup guides.\n- **[Architecture](https://peterbud.github.io/nuxt-aegis/architecture/)** - Overview of the system architecture.\n- **[Providers](https://peterbud.github.io/nuxt-aegis/providers/)** - Configure Google, GitHub, Auth0, Password, and Mock providers.\n- **[Configuration](https://peterbud.github.io/nuxt-aegis/configuration/)** - Detailed configuration options.\n- **[Route Protection](https://peterbud.github.io/nuxt-aegis/guides/route-protection)** - Learn how to protect your pages and API routes.\n- **[Custom Claims](https://peterbud.github.io/nuxt-aegis/guides/custom-claims)** - Add custom data to your JWTs.\n- **[API Reference](https://peterbud.github.io/nuxt-aegis/api/)** - Detailed API documentation.\n\n## Contributing\n\nContributions are welcome! Please see the [Requirements Specification](/specs/requirements.md) for detailed technical requirements.\n\n\u003cdetails\u003e\n\u003csummary\u003eLocal development\u003c/summary\u003e\n\n```bash\n# Install dependencies\npnpm install\n\n# Start development server\npnpm dev\n\n# Run tests\npnpm test\n\n# Lint \u0026 type check\npnpm lint\n```\n\u003c/details\u003e\n\nIf you want to report a bug, please make sure you have a minimal reproduction of the issue. You can use the [minimal example](https://stackblitz.com/github/peterbud/nuxt-aegis/tree/main/examples/minimal?title=Nuxt-Aegis%20Minimal%20Example) to create a reproduction.\n\n\n## License\n\n[MIT License](./LICENSE)\n\n## Acknowledgments\n\n- Built with [Nuxt Module Builder](https://github.com/nuxt/module-builder)\n- JWT handling powered by [jose](https://github.com/panva/jose)\n- Heavily inspired by the [nuxt-auth-utils](https://github.com/atinux/nuxt-auth-utils) and  Nuxt community\n\nMade with ❤️ for the Nuxt community\n\n\u003c!-- Badges --\u003e\n[npm-version-src]: https://img.shields.io/npm/v/nuxt-aegis/latest.svg\\?style\\=flat\\\u0026colorA\\=020420\\\u0026colorB\\=00DC82\n[npm-version-href]: https://npmjs.com/package/@peterbud/nuxt-aegis\n\n[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-aegis.svg\\?style\\=flat\\\u0026colorA\\=020420\\\u0026colorB\\=00DC82\n[npm-downloads-href]: https://npm.chart.dev/@peterbud/nuxt-aegis\n\n[license-src]: https://img.shields.io/npm/l/nuxt-aegis.svg\\?style\\=flat\\\u0026colorA\\=020420\\\u0026colorB\\=00DC82\n[license-href]: https://npmjs.com/package/@peterbud/nuxt-aegis\n\n[nuxt-src]: https://img.shields.io/badge/Nuxt-020420\\?logo\\=nuxt.js\n[nuxt-href]: https://nuxt.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterbud%2Fnuxt-aegis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterbud%2Fnuxt-aegis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterbud%2Fnuxt-aegis/lists"}