[{"data":1,"prerenderedAt":688},["ShallowReactive",2],{"navigation_docs":3,"-getting-started-installation":152,"-getting-started-installation-surround":683},[4,42,68,110,131],{"title":5,"path":6,"stem":7,"children":8,"icon":11},"Getting Started","/getting-started","1.getting-started/0.index",[9,12,17,22,27,32,37],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-sparkles",{"title":13,"path":14,"stem":15,"icon":16},"Installation","/getting-started/installation","1.getting-started/1.installation","i-lucide-download",{"title":18,"path":19,"stem":20,"icon":21},"Configuration","/getting-started/configuration","1.getting-started/2.configuration","i-lucide-settings",{"title":23,"path":24,"stem":25,"icon":26},"Client Setup","/getting-started/client-setup","1.getting-started/3.client-setup","i-lucide-monitor",{"title":28,"path":29,"stem":30,"icon":31},"Type Augmentation","/getting-started/type-augmentation","1.getting-started/4.type-augmentation","i-lucide-type",{"title":33,"path":34,"stem":35,"icon":36},"Schema Generation (NuxtHub)","/getting-started/schema-generation","1.getting-started/5.schema-generation","i-lucide-database",{"title":38,"path":39,"stem":40,"icon":41},"How It Works","/getting-started/how-it-works","1.getting-started/6.how-it-works","i-lucide-workflow",{"title":43,"path":44,"stem":45,"children":46,"page":67},"Core Concepts","/core-concepts","2.core-concepts",[47,51,55,59,63],{"title":48,"path":49,"stem":50},"serverAuth()","/core-concepts/server-auth","2.core-concepts/1.server-auth",{"title":52,"path":53,"stem":54},"Sessions","/core-concepts/sessions","2.core-concepts/2.sessions",{"title":56,"path":57,"stem":58},"Route Protection","/core-concepts/route-protection","2.core-concepts/3.route-protection",{"title":60,"path":61,"stem":62},"Auto‑Imports and Aliases","/core-concepts/auto-imports-aliases","2.core-concepts/4.auto-imports-aliases",{"title":64,"path":65,"stem":66},"Security & Caveats","/core-concepts/security-caveats","2.core-concepts/5.security-caveats",false,{"title":69,"path":70,"stem":71,"children":72,"page":67},"Guides","/guides","3.guides",[73,77,81,85,89,94,98,102,106],{"title":74,"path":75,"stem":76},"Role‑Based Access","/guides/role-based-access","3.guides/1.role-based-access",{"title":78,"path":79,"stem":80},"OAuth Providers","/guides/oauth-providers","3.guides/2.oauth-providers",{"title":82,"path":83,"stem":84},"Custom Database","/guides/custom-database","3.guides/3.custom-database",{"title":86,"path":87,"stem":88},"Database-less Mode","/guides/database-less-mode","3.guides/4.database-less-mode",{"title":90,"path":91,"stem":92,"icon":93},"External Auth Backend","/guides/external-auth-backend","3.guides/5.external-auth-backend","i-lucide-server",{"title":95,"path":96,"stem":97},"Migrating from nuxt-auth-utils","/guides/migrate-from-nuxt-auth-utils","3.guides/6.migrate-from-nuxt-auth-utils",{"title":99,"path":100,"stem":101},"Two-Factor Authentication (TOTP + Backup Codes)","/guides/two-factor-auth","3.guides/7.two-factor-auth",{"title":103,"path":104,"stem":105},"Testing","/guides/testing","3.guides/8.testing",{"title":107,"path":108,"stem":109},"Production Deployment","/guides/production-deployment","3.guides/9.production-deployment",{"title":111,"path":112,"stem":113,"children":114,"page":67},"Integrations","/integrations","4.integrations",[115,119,123,127],{"title":116,"path":117,"stem":118},"NuxtHub","/integrations/nuxthub","4.integrations/1.nuxthub",{"title":120,"path":121,"stem":122},"DevTools","/integrations/devtools","4.integrations/2.devtools",{"title":124,"path":125,"stem":126},"Convex","/integrations/convex","4.integrations/3.convex",{"title":128,"path":129,"stem":130},"i18n","/integrations/i18n","4.integrations/4.i18n",{"title":132,"path":133,"stem":134,"children":135,"page":67},"API Reference","/api","5.api",[136,140,144,148],{"title":137,"path":138,"stem":139},"Composables","/api/composables","5.api/1.composables",{"title":141,"path":142,"stem":143},"Server Utilities","/api/server-utils","5.api/2.server-utils",{"title":145,"path":146,"stem":147},"Components","/api/components","5.api/3.components",{"title":149,"path":150,"stem":151},"Types","/api/types","5.api/4.types",{"id":153,"title":13,"body":154,"description":676,"extension":677,"links":678,"meta":679,"navigation":680,"path":14,"seo":681,"stem":15,"__hash__":682},"docs/1.getting-started/1.installation.md",{"type":155,"value":156,"toc":666},"minimark",[157,234,238,243,260,264,585,589,592,613,617,644,655,662],[158,159,160],"code-collapse",{},[161,162,168],"pre",{"className":163,"code":164,"filename":165,"language":166,"meta":167,"style":167},"language-txt shiki shiki-themes one-light synthwave-84 synthwave-84","Install @nuxtjs/better-auth in my Nuxt 4 app.\n\n- Read the raw installation documentation first: https://better-auth.nuxt.dev/raw/getting-started/installation.md\n- Run `npx nuxi module add @nuxtjs/better-auth`\n- Set `NUXT_BETTER_AUTH_SECRET` or `BETTER_AUTH_SECRETS` in `.env` (at least 32 chars per current secret, high entropy)\n- Optionally set `NUXT_PUBLIC_SITE_URL` for non-auto-detected platforms\n- Create `server/auth.config.ts` using `defineServerAuth` from `@nuxtjs/better-auth/config`\n- Create `app/auth.config.ts` using `defineClientAuth` from `@nuxtjs/better-auth/config`\n- The module auto-injects `secret` and `baseURL` — do not configure them manually\n- In `defineServerAuth`, use the app config callback's `requestOrigin` when Better Auth needs the current request host, such as `trustedOrigins`\n","Prompt","txt","",[169,170,171,179,186,192,198,204,210,216,222,228],"code",{"__ignoreMap":167},[172,173,176],"span",{"class":174,"line":175},"line",1,[172,177,178],{},"Install @nuxtjs/better-auth in my Nuxt 4 app.\n",[172,180,182],{"class":174,"line":181},2,[172,183,185],{"emptyLinePlaceholder":184},true,"\n",[172,187,189],{"class":174,"line":188},3,[172,190,191],{},"- Read the raw installation documentation first: https://better-auth.nuxt.dev/raw/getting-started/installation.md\n",[172,193,195],{"class":174,"line":194},4,[172,196,197],{},"- Run `npx nuxi module add @nuxtjs/better-auth`\n",[172,199,201],{"class":174,"line":200},5,[172,202,203],{},"- Set `NUXT_BETTER_AUTH_SECRET` or `BETTER_AUTH_SECRETS` in `.env` (at least 32 chars per current secret, high entropy)\n",[172,205,207],{"class":174,"line":206},6,[172,208,209],{},"- Optionally set `NUXT_PUBLIC_SITE_URL` for non-auto-detected platforms\n",[172,211,213],{"class":174,"line":212},7,[172,214,215],{},"- Create `server/auth.config.ts` using `defineServerAuth` from `@nuxtjs/better-auth/config`\n",[172,217,219],{"class":174,"line":218},8,[172,220,221],{},"- Create `app/auth.config.ts` using `defineClientAuth` from `@nuxtjs/better-auth/config`\n",[172,223,225],{"class":174,"line":224},9,[172,226,227],{},"- The module auto-injects `secret` and `baseURL` — do not configure them manually\n",[172,229,231],{"class":174,"line":230},10,[172,232,233],{},"- In `defineServerAuth`, use the app config callback's `requestOrigin` when Better Auth needs the current request host, such as `trustedOrigins`\n",[235,236,237],"p",{},"Use this page when you want the full install checklist rather than the shorter quickstart.",[239,240,242],"h2",{"id":241},"prerequisites","Prerequisites",[244,245,246,250,253],"ul",{},[247,248,249],"li",{},"Nuxt v4.0+",[247,251,252],{},"a package manager configured for your app",[247,254,255,256,259],{},"a local ",[169,257,258],{},".env"," file or deployment environment variable system",[239,261,263],{"id":262},"add-to-project","Add to project",[265,266,267,272,298,302,328,334,343,346,355,358,361,381,390,393,402,410,413,422,426,445,448,469,472,549],"steps",{},[268,269,271],"h3",{"id":270},"install-the-module","Install the module",[161,273,277],{"className":274,"code":275,"language":276,"meta":167,"style":167},"language-bash shiki shiki-themes one-light synthwave-84 synthwave-84","npx nuxi module add @nuxtjs/better-auth\n","bash",[169,278,279],{"__ignoreMap":167},[172,280,281,285,289,292,295],{"class":174,"line":175},[172,282,284],{"class":283},"siqUp","npx",[172,286,288],{"class":287},"sI3kV"," nuxi",[172,290,291],{"class":287}," module",[172,293,294],{"class":287}," add",[172,296,297],{"class":287}," @nuxtjs/better-auth\n",[268,299,301],{"id":300},"set-environment-variables","Set environment variables",[303,304,305,306,309,310,313,314,316,317,319,320,323,324,327],"tip",{"icon":11},"When you install the module with ",[169,307,308],{},"nuxi module add",", it prompts you to generate ",[169,311,312],{},"NUXT_BETTER_AUTH_SECRET"," and can append it to your ",[169,315,258],{},". The prompt is skipped when ",[169,318,312],{},", ",[169,321,322],{},"BETTER_AUTH_SECRET",", or ",[169,325,326],{},"BETTER_AUTH_SECRETS"," is already configured. In CI/test environments it auto-generates the singular secret.",[235,329,330,331,333],{},"Add these environment variables to ",[169,332,258],{},":",[335,336,337],"ol",{},[247,338,339],{},[340,341,342],"strong",{},"Secret Key",[235,344,345],{},"The secret encrypts and hashes sensitive data. Must be at least 32 characters with high entropy.",[161,347,349],{"className":163,"code":348,"filename":258,"language":166,"meta":167,"style":167},"NUXT_BETTER_AUTH_SECRET=\n",[169,350,351],{"__ignoreMap":167},[172,352,353],{"class":174,"line":175},[172,354,348],{},[356,357],"generate-secret",{},[235,359,360],{},"Or generate via terminal:",[161,362,364],{"className":274,"code":363,"language":276,"meta":167,"style":167},"openssl rand -base64 32\n",[169,365,366],{"__ignoreMap":167},[172,367,368,371,374,378],{"class":174,"line":175},[172,369,370],{"class":283},"openssl",[172,372,373],{"class":287}," rand",[172,375,377],{"class":376},"s3ZNE"," -base64",[172,379,380],{"class":376}," 32\n",[303,382,383,384,386,387,389],{},"Use ",[169,385,312],{}," for Nuxt runtime config and multi-environment deployments. ",[169,388,322],{}," remains supported as a fallback.",[235,391,392],{},"For non-destructive rotation, use Better Auth's versioned environment variable instead:",[161,394,396],{"className":163,"code":395,"filename":258,"language":166,"meta":167,"style":167},"BETTER_AUTH_SECRETS=2:current-secret-must-be-at-least-32-characters,1:previous-secret-must-be-at-least-32-characters\n",[169,397,398],{"__ignoreMap":167},[172,399,400],{"class":174,"line":175},[172,401,395],{},[335,403,404],{"start":181},[247,405,406,409],{},[340,407,408],{},"Base URL"," (Optional)",[235,411,412],{},"The module auto-detects the URL on Vercel, Cloudflare Pages, and Netlify. Set manually for other platforms.",[161,414,416],{"className":163,"code":415,"filename":258,"language":166,"meta":167,"style":167},"NUXT_PUBLIC_SITE_URL=https://your-domain.com\n",[169,417,418],{"__ignoreMap":167},[172,419,420],{"class":174,"line":175},[172,421,415],{},[268,423,425],{"id":424},"create-configuration-files","Create configuration files",[303,427,428,429,432,433,436,437,440,441,444],{"icon":11},"During module install, ",[169,430,431],{},"server/auth.config.ts"," and ",[169,434,435],{},"\u003CsrcDir>/auth.config.ts"," are scaffolded if missing. The client config is placed in your ",[169,438,439],{},"srcDir"," (e.g., ",[169,442,443],{},"app/"," or project root).",[235,446,447],{},"The module requires two configuration files:",[335,449,450,458],{},[247,451,452,455,456],{},[340,453,454],{},"Server Configuration",": ",[169,457,431],{},[247,459,460,455,463,440,465,468],{},[340,461,462],{},"Client Configuration",[169,464,435],{},[169,466,467],{},"app/auth.config.ts",")",[235,470,471],{},"Create these files with the following content:",[161,473,477],{"className":474,"code":475,"filename":431,"language":476,"meta":167,"style":167},"language-ts shiki shiki-themes one-light synthwave-84 synthwave-84","import { defineServerAuth } from '@nuxtjs/better-auth/config'\n\nexport default defineServerAuth({\n  emailAndPassword: { enabled: true }\n})\n","ts",[169,478,479,503,507,523,544],{"__ignoreMap":167},[172,480,481,485,489,493,496,499],{"class":174,"line":175},[172,482,484],{"class":483},"sqe1H","import",[172,486,488],{"class":487},"s17Py"," { ",[172,490,492],{"class":491},"sYvLG","defineServerAuth",[172,494,495],{"class":487}," } ",[172,497,498],{"class":483},"from",[172,500,502],{"class":501},"sPAZv"," '@nuxtjs/better-auth/config'\n",[172,504,505],{"class":174,"line":181},[172,506,185],{"emptyLinePlaceholder":184},[172,508,509,512,516,520],{"class":174,"line":188},[172,510,511],{"class":483},"export",[172,513,515],{"class":514},"sKg8T"," default",[172,517,519],{"class":518},"sfT9l"," defineServerAuth",[172,521,522],{"class":487},"({\n",[172,524,525,528,531,533,536,538,541],{"class":174,"line":194},[172,526,527],{"class":491},"  emailAndPassword",[172,529,333],{"class":530},"sVnqq",[172,532,488],{"class":487},[172,534,535],{"class":491},"enabled",[172,537,333],{"class":530},[172,539,540],{"class":376}," true",[172,542,543],{"class":487}," }\n",[172,545,546],{"class":174,"line":200},[172,547,548],{"class":487},"})\n",[161,550,552],{"className":474,"code":551,"filename":467,"language":476,"meta":167,"style":167},"import { defineClientAuth } from '@nuxtjs/better-auth/config'\n\nexport default defineClientAuth({})\n",[169,553,554,569,573],{"__ignoreMap":167},[172,555,556,558,560,563,565,567],{"class":174,"line":175},[172,557,484],{"class":483},[172,559,488],{"class":487},[172,561,562],{"class":491},"defineClientAuth",[172,564,495],{"class":487},[172,566,498],{"class":483},[172,568,502],{"class":501},[172,570,571],{"class":174,"line":181},[172,572,185],{"emptyLinePlaceholder":184},[172,574,575,577,579,582],{"class":174,"line":188},[172,576,511],{"class":483},[172,578,515],{"class":514},[172,580,581],{"class":518}," defineClientAuth",[172,583,584],{"class":487},"({})\n",[239,586,588],{"id":587},"verify-the-installation","Verify the installation",[235,590,591],{},"Confirm all of the following:",[244,593,594,597,602,610],{},[247,595,596],{},"Nuxt starts without missing-config errors",[247,598,599,601],{},[169,600,431],{}," exists",[247,603,604,606,607,609],{},[169,605,467],{}," or your ",[169,608,439],{}," equivalent exists",[247,611,612],{},"a singular or versioned auth secret is available at runtime",[239,614,616],{"id":615},"next-steps","Next steps",[244,618,619,627,633],{},[247,620,621,622,626],{},"Continue with ",[623,624,625],"a",{"href":19},"configuration"," to set module options and route protection.",[247,628,621,629,632],{},[623,630,631],{"href":24},"client setup"," to wire sign-in and sign-out flows.",[247,634,635,636,639,640,643],{},"If you need durable persistence, pick either ",[623,637,638],{"href":117},"NuxtHub integration"," or ",[623,641,642],{"href":83},"custom database",".",[645,646,647,650,651,654],"callout",{"icon":36,"to":117},[340,648,649],{},"Need database persistence?"," See ",[623,652,653],{"href":117},"NuxtHub Integration"," for auto-generated schemas and full database support.",[645,656,658,661],{"icon":657,"to":83},"i-lucide-hard-drive",[340,659,660],{},"Bring your own database?"," Use Drizzle, Prisma, or Kysely adapters with any database.",[663,664,665],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .siqUp, html code.shiki .siqUp{--shiki-light:#4078F2;--shiki-default:#FE4450;--shiki-dark:#FE4450}html pre.shiki code .sI3kV, html code.shiki .sI3kV{--shiki-light:#50A14F;--shiki-default:#BBBBBB;--shiki-dark:#BBBBBB}html pre.shiki code .s3ZNE, html code.shiki .s3ZNE{--shiki-light:#986801;--shiki-default:#F97E72;--shiki-dark:#F97E72}html pre.shiki code .sqe1H, html code.shiki .sqe1H{--shiki-light:#A626A4;--shiki-default:#FEDE5D;--shiki-dark:#FEDE5D}html pre.shiki code .s17Py, html code.shiki .s17Py{--shiki-light:#383A42;--shiki-default:#BBBBBB;--shiki-dark:#BBBBBB}html pre.shiki code .sYvLG, html code.shiki .sYvLG{--shiki-light:#E45649;--shiki-default:#FF7EDB;--shiki-dark:#FF7EDB}html pre.shiki code .sPAZv, html code.shiki .sPAZv{--shiki-light:#50A14F;--shiki-default:#FF8B39;--shiki-dark:#FF8B39}html pre.shiki code .sKg8T, html code.shiki .sKg8T{--shiki-light:#E45649;--shiki-default:#FEDE5D;--shiki-dark:#FEDE5D}html pre.shiki code .sfT9l, html code.shiki .sfT9l{--shiki-light:#4078F2;--shiki-default:#36F9F6;--shiki-dark:#36F9F6}html pre.shiki code .sVnqq, html code.shiki .sVnqq{--shiki-light:#0184BC;--shiki-default:#B6B1B1;--shiki-dark:#B6B1B1}",{"title":167,"searchDepth":181,"depth":181,"links":667},[668,669,674,675],{"id":241,"depth":181,"text":242},{"id":262,"depth":181,"text":263,"children":670},[671,672,673],{"id":270,"depth":188,"text":271},{"id":300,"depth":188,"text":301},{"id":424,"depth":188,"text":425},{"id":587,"depth":181,"text":588},{"id":615,"depth":181,"text":616},"Learn how to add Nuxt Better Auth to your Nuxt project.","md",null,{},{"icon":16},{"title":13,"description":676},"f2virXjtDprOzWhvXDlN1iIzpBEhOa6weGtIG7pqllI",[684,686],{"title":10,"path":6,"stem":7,"description":685,"icon":11,"children":-1},"Nuxt Better Auth integrates Better Auth with Nuxt for route protection, session management, and schema generation.",{"title":18,"path":19,"stem":20,"description":687,"icon":21,"children":-1},"Configure the module options and your Better Auth server instance.",1787153787161]