[{"data":1,"prerenderedAt":671},["ShallowReactive",2],{"navigation_docs":3,"-getting-started-installation":152,"-getting-started-installation-surround":666},[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":659,"extension":660,"links":661,"meta":662,"navigation":663,"path":14,"seo":664,"stem":15,"__hash__":665},"docs/1.getting-started/1.installation.md",{"type":155,"value":156,"toc":649},"minimark",[157,234,238,243,260,264,566,570,573,596,600,627,638,645],[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 @onmax/nuxt-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 @onmax/nuxt-better-auth@alpha`\n- Set `BETTER_AUTH_SECRET` in `.env` (at least 32 chars, high entropy). Optionally prefix with `NUXT_` for runtime config\n- Optionally set `NUXT_PUBLIC_SITE_URL` for non-auto-detected platforms\n- Create `server/auth.config.ts` using `defineServerAuth` from `@onmax/nuxt-better-auth/config`\n- Create `app/auth.config.ts` using `defineClientAuth` from `@onmax/nuxt-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 @onmax/nuxt-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 @onmax/nuxt-better-auth@alpha`\n",[172,199,201],{"class":174,"line":200},5,[172,202,203],{},"- Set `BETTER_AUTH_SECRET` in `.env` (at least 32 chars, high entropy). Optionally prefix with `NUXT_` for runtime config\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 `@onmax/nuxt-better-auth/config`\n",[172,217,219],{"class":174,"line":218},8,[172,220,221],{},"- Create `app/auth.config.ts` using `defineClientAuth` from `@onmax/nuxt-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,321,327,336,339,348,351,354,374,383,391,394,403,407,426,429,450,453,530],"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 @onmax/nuxt-better-auth@alpha\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}," @onmax/nuxt-better-auth@alpha\n",[268,299,301],{"id":300},"set-environment-variables","Set environment variables",[303,304,305,306,309,310,313,314,316,317,320],"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],{},". ",[169,318,319],{},"BETTER_AUTH_SECRET"," still works as a compatibility fallback. In CI/test environments it auto-generates the secret.",[235,322,323,324,326],{},"Add these environment variables to ",[169,325,258],{},":",[328,329,330],"ol",{},[247,331,332],{},[333,334,335],"strong",{},"Secret Key",[235,337,338],{},"The secret encrypts and hashes sensitive data. Must be at least 32 characters with high entropy.",[161,340,342],{"className":163,"code":341,"filename":258,"language":166,"meta":167,"style":167},"NUXT_BETTER_AUTH_SECRET=\n",[169,343,344],{"__ignoreMap":167},[172,345,346],{"class":174,"line":175},[172,347,341],{},[349,350],"generate-secret",{},[235,352,353],{},"Or generate via terminal:",[161,355,357],{"className":274,"code":356,"language":276,"meta":167,"style":167},"openssl rand -base64 32\n",[169,358,359],{"__ignoreMap":167},[172,360,361,364,367,371],{"class":174,"line":175},[172,362,363],{"class":283},"openssl",[172,365,366],{"class":287}," rand",[172,368,370],{"class":369},"s3ZNE"," -base64",[172,372,373],{"class":369}," 32\n",[303,375,376,377,379,380,382],{},"Use ",[169,378,312],{}," for Nuxt runtime config and multi-environment deployments. ",[169,381,319],{}," remains supported as a fallback.",[328,384,385],{"start":181},[247,386,387,390],{},[333,388,389],{},"Base URL"," (Optional)",[235,392,393],{},"The module auto-detects the URL on Vercel, Cloudflare Pages, and Netlify. Set manually for other platforms.",[161,395,397],{"className":163,"code":396,"filename":258,"language":166,"meta":167,"style":167},"NUXT_PUBLIC_SITE_URL=https://your-domain.com\n",[169,398,399],{"__ignoreMap":167},[172,400,401],{"class":174,"line":175},[172,402,396],{},[268,404,406],{"id":405},"create-configuration-files","Create configuration files",[303,408,409,410,413,414,417,418,421,422,425],{"icon":11},"During module install, ",[169,411,412],{},"server/auth.config.ts"," and ",[169,415,416],{},"\u003CsrcDir>/auth.config.ts"," are scaffolded if missing. The client config is placed in your ",[169,419,420],{},"srcDir"," (e.g., ",[169,423,424],{},"app/"," or project root).",[235,427,428],{},"The module requires two configuration files:",[328,430,431,439],{},[247,432,433,436,437],{},[333,434,435],{},"Server Configuration",": ",[169,438,412],{},[247,440,441,436,444,421,446,449],{},[333,442,443],{},"Client Configuration",[169,445,416],{},[169,447,448],{},"app/auth.config.ts",")",[235,451,452],{},"Create these files with the following content:",[161,454,458],{"className":455,"code":456,"filename":412,"language":457,"meta":167,"style":167},"language-ts shiki shiki-themes one-light synthwave-84 synthwave-84","import { defineServerAuth } from '@onmax/nuxt-better-auth/config'\n\nexport default defineServerAuth({\n  emailAndPassword: { enabled: true }\n})\n","ts",[169,459,460,484,488,504,525],{"__ignoreMap":167},[172,461,462,466,470,474,477,480],{"class":174,"line":175},[172,463,465],{"class":464},"sqe1H","import",[172,467,469],{"class":468},"s17Py"," { ",[172,471,473],{"class":472},"sYvLG","defineServerAuth",[172,475,476],{"class":468}," } ",[172,478,479],{"class":464},"from",[172,481,483],{"class":482},"sPAZv"," '@onmax/nuxt-better-auth/config'\n",[172,485,486],{"class":174,"line":181},[172,487,185],{"emptyLinePlaceholder":184},[172,489,490,493,497,501],{"class":174,"line":188},[172,491,492],{"class":464},"export",[172,494,496],{"class":495},"sKg8T"," default",[172,498,500],{"class":499},"sfT9l"," defineServerAuth",[172,502,503],{"class":468},"({\n",[172,505,506,509,512,514,517,519,522],{"class":174,"line":194},[172,507,508],{"class":472},"  emailAndPassword",[172,510,326],{"class":511},"sVnqq",[172,513,469],{"class":468},[172,515,516],{"class":472},"enabled",[172,518,326],{"class":511},[172,520,521],{"class":369}," true",[172,523,524],{"class":468}," }\n",[172,526,527],{"class":174,"line":200},[172,528,529],{"class":468},"})\n",[161,531,533],{"className":455,"code":532,"filename":448,"language":457,"meta":167,"style":167},"import { defineClientAuth } from '@onmax/nuxt-better-auth/config'\n\nexport default defineClientAuth({})\n",[169,534,535,550,554],{"__ignoreMap":167},[172,536,537,539,541,544,546,548],{"class":174,"line":175},[172,538,465],{"class":464},[172,540,469],{"class":468},[172,542,543],{"class":472},"defineClientAuth",[172,545,476],{"class":468},[172,547,479],{"class":464},[172,549,483],{"class":482},[172,551,552],{"class":174,"line":181},[172,553,185],{"emptyLinePlaceholder":184},[172,555,556,558,560,563],{"class":174,"line":188},[172,557,492],{"class":464},[172,559,496],{"class":495},[172,561,562],{"class":499}," defineClientAuth",[172,564,565],{"class":468},"({})\n",[239,567,569],{"id":568},"verify-the-installation","Verify the installation",[235,571,572],{},"Confirm all of the following:",[244,574,575,578,583,591],{},[247,576,577],{},"Nuxt starts without missing-config errors",[247,579,580,582],{},[169,581,412],{}," exists",[247,584,585,587,588,590],{},[169,586,448],{}," or your ",[169,589,420],{}," equivalent exists",[247,592,593,595],{},[169,594,312],{}," is available at runtime",[239,597,599],{"id":598},"next-steps","Next steps",[244,601,602,610,616],{},[247,603,604,605,609],{},"Continue with ",[606,607,608],"a",{"href":19},"configuration"," to set module options and route protection.",[247,611,604,612,615],{},[606,613,614],{"href":24},"client setup"," to wire sign-in and sign-out flows.",[247,617,618,619,622,623,626],{},"If you need durable persistence, pick either ",[606,620,621],{"href":117},"NuxtHub integration"," or ",[606,624,625],{"href":83},"custom database",".",[628,629,630,633,634,637],"callout",{"icon":36,"to":117},[333,631,632],{},"Need database persistence?"," See ",[606,635,636],{"href":117},"NuxtHub Integration"," for auto-generated schemas and full database support.",[628,639,641,644],{"icon":640,"to":83},"i-lucide-hard-drive",[333,642,643],{},"Bring your own database?"," Use Drizzle, Prisma, or Kysely adapters with any database.",[646,647,648],"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":650},[651,652,657,658],{"id":241,"depth":181,"text":242},{"id":262,"depth":181,"text":263,"children":653},[654,655,656],{"id":270,"depth":188,"text":271},{"id":300,"depth":188,"text":301},{"id":405,"depth":188,"text":406},{"id":568,"depth":181,"text":569},{"id":598,"depth":181,"text":599},"Learn how to add Nuxt Better Auth to your Nuxt project.","md",null,{},{"icon":16},{"title":13,"description":659},"hWDDUN8rQMfKlp16mHZiSc19eQlXUk4cxpgbZTXAFLw",[667,669],{"title":10,"path":6,"stem":7,"description":668,"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":670,"icon":21,"children":-1},"Configure the module options and your Better Auth server instance.",1778769541442]