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