nuxt-better-auth

Manages authentication and authorization for Nuxt.js apps via onmax/nuxt-better-auth module.

Updated Jan 2, 2026
One-click install
npx skills add https://github.com/onmax/claude-config --skill nuxt-better-auth-onmax
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nuxt-better-auth
Source: https://github.com/onmax/claude-config/tree/main/skills/nuxt-better-auth
Command: npx skills add https://github.com/onmax/claude-config --skill nuxt-better-auth-onmax

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill simplifies and secures authentication flows in Nuxt applications, providing essential tools for user management, route protection, and integration with various auth providers.

Core Features & Use Cases

  • User Session Management: Provides composables like useUserSession for client-side access to user data and authentication status.
  • Server-Side Protection: Offers utilities like requireUserSession to protect API routes and server endpoints.
  • Route Protection: Enables route-level authentication rules via nuxt.config.ts and definePageMeta.
  • Plugin Integration: Seamlessly integrates with Better Auth plugins for features like admin roles, two-factor authentication, and passkeys.
  • Use Case: Securely protect your /admin routes for administrators only, allow any logged-in user into /dashboard, and redirect unauthenticated users from /login to /.

Quick Start

Configure your Nuxt application to protect the /admin route for users with the 'admin' role.

Frequently Asked Questions about nuxt-better-auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I protect specific routes in a Nuxt application based on user roles?

Route protection in Nuxt is configured via `nuxt.config.ts` and `definePageMeta`. You can restrict access to specific paths like `/admin` by enforcing role-based authentication rules, ensuring only authorized users reach protected pages.

What is the best way to manage user sessions on both the client and server side in Nuxt?

Session management is handled using the `useUserSession` composable for client-side data access and `requireUserSession` for server-side endpoint protection. This ensures consistent authentication state across your Nuxt application.

Does Nuxt authentication support advanced security features like 2FA and passkeys?

Yes, Nuxt authentication supports advanced security features like 2FA and passkeys through Better Auth plugin integration. This allows you to add two-factor authentication and admin role management to your application.

Can I use an external authentication backend while keeping routes protected in Nuxt?

Yes, you can use an external authentication backend using the client-only mode. This allows you to manage authentication externally while still leveraging Nuxt's route protection and session composables.

How do I redirect unauthenticated users away from restricted pages in Nuxt?

You redirect unauthenticated users by defining route-level authentication rules. For example, configuring `/login` to redirect already authenticated users to `/` while blocking unauthenticated access to restricted areas like `/dashboard`.

Do I need NuxtHub to handle database integration for user authentication?

NuxtHub is supported for database integration within your authentication flow. It provides the backend data storage required to manage user accounts and session states natively within your Nuxt application environment.