What problem does it solve?
This Skill simplifies the implementation of secure authentication and authorization in Nuxt 4+ applications, handling user sessions, route protection, and integration with various auth providers.
Core Features & Use Cases
- User Session Management: Provides composables like
useUserSession for accessing user data and authentication status.
- Route Protection: Enables protection of client and server routes using
routeRules and middleware based on authentication status or user roles.
- Server-Side Auth Helpers: Offers utilities like
requireUserSession to enforce authentication on API routes.
- Plugin Integration: Supports Better Auth plugins for features like admin roles, two-factor authentication, and passkeys.
- Use Case: Securely build a dashboard for your Nuxt application where only authenticated users with an 'admin' role can access specific sections, while guest users are redirected to a login page.
Quick Start
Install the module and configure your server and client authentication settings in nuxt.config.ts and server/auth.config.ts.