---
name: nuxt-better-auth-fc299f88646c
description: Guides authentication in Nuxt apps using @nuxtjs/better-auth. Use when installing or configuring the module, using its client or server APIs, protecting routes, refreshing sessions, or integrating Better Auth plugins.
license: MIT
---

# Nuxt Better Auth

Use the smallest reference that matches the task.

## Pick a reference

| Task | Read |
| --- | --- |
| Install the module, configure environment variables, or create config files | [references/installation.md](references/installation.md) |
| Read client session state, build auth forms, call plugins, or fetch auth-bound data | [references/client-auth.md](references/client-auth.md) |
| Read or enforce sessions in server handlers, create sessions, or refresh cached session data | [references/server-auth.md](references/server-auth.md) |
| Protect pages or API routes and configure redirects | [references/route-protection.md](references/route-protection.md) |
| Register Better Auth plugins and their client companions | [references/plugins.md](references/plugins.md) |
| Configure NuxtHub, generated schema, or secondary storage | [references/database.md](references/database.md) |
| Connect a Nuxt frontend to an external Better Auth server | [references/client-only.md](references/client-only.md) |
| Use inferred auth types or add project fields | [references/types.md](references/types.md) |

## Rules that apply across tasks

- Confirm the consumer's installed package version supports each API you use. The published skill may be newer than the consumer's lockfile.
- Enforce protected API reads and mutations server-side with `requireUserSession(event)`. Route rules and page meta also control navigation.
- Navigate only to validated local redirect paths.
- In `clientOnly` mode, do not use local server helpers or expect SSR session hydration.
- After server-side changes to session payload fields, call `refreshSessionCookieCache(event)`. Wrap custom client auth endpoints that create or change the current session with `runWithSessionRefresh()`.

Before finishing an implementation, run the consumer's typecheck and the narrowest relevant auth test.

## Resources

- [Documentation site](https://better-auth.nuxt.dev)
- [Better Auth docs](https://www.better-auth.com/)


---
Source attribution: onmax
Original project: https://github.com/onmax/nuxt-skills/blob/2e74504f3151b18bf81e8a62cb7f1fa9edb532a4/skills/nuxt-better-auth/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: onmax
Original project: https://github.com/onmax/nuxt-skills/blob/2e74504f3151b18bf81e8a62cb7f1fa9edb532a4/skills/nuxt-better-auth/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering, Product Management, Design
Roles: Frontend Developer, Product Manager, UX Designer
Specialties: Frontend, Word Documents, Git, API, Database, Backend
Tools: @Onmax/Nuxt Better Auth
Country applicability: Country not specified
Classification basis: Source category, role and specialization labels
Instruction SHA-256: 4e45e21131d5367036c989cd2a0ee48746b1c880eb30c0e288acabdeb27aee2c
