[{"data":1,"prerenderedAt":602},["ShallowReactive",2],{"navigation_docs":3,"-getting-started-installation":152,"-getting-started-installation-surround":597},[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":590,"extension":591,"links":592,"meta":593,"navigation":594,"path":14,"seo":595,"stem":15,"__hash__":596},"docs/1.getting-started/1.installation.md",{"type":155,"value":156,"toc":582},"minimark",[157,239,244,251,255,559,571,578],[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- 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\nRead more: https://better-auth.nuxt.dev/raw/getting-started/installation.md\nSource: https://github.com/nuxt-modules/better-auth\n","Prompt","txt","",[169,170,171,179,186,192,198,204,210,216,222,227,233],"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],{},"- Run `npx nuxi module add @onmax/nuxt-better-auth@alpha`\n",[172,193,195],{"class":174,"line":194},4,[172,196,197],{},"- Set `BETTER_AUTH_SECRET` in `.env` (at least 32 chars, high entropy). Optionally prefix with `NUXT_` for runtime config\n",[172,199,201],{"class":174,"line":200},5,[172,202,203],{},"- Optionally set `NUXT_PUBLIC_SITE_URL` for non-auto-detected platforms\n",[172,205,207],{"class":174,"line":206},6,[172,208,209],{},"- Create `server/auth.config.ts` using `defineServerAuth` from `@onmax/nuxt-better-auth/config`\n",[172,211,213],{"class":174,"line":212},7,[172,214,215],{},"- Create `app/auth.config.ts` using `defineClientAuth` from `@onmax/nuxt-better-auth/config`\n",[172,217,219],{"class":174,"line":218},8,[172,220,221],{},"- The module auto-injects `secret` and `baseURL` — do not configure them manually\n",[172,223,225],{"class":174,"line":224},9,[172,226,185],{"emptyLinePlaceholder":184},[172,228,230],{"class":174,"line":229},10,[172,231,232],{},"Read more: https://better-auth.nuxt.dev/raw/getting-started/installation.md\n",[172,234,236],{"class":174,"line":235},11,[172,237,238],{},"Source: https://github.com/nuxt-modules/better-auth\n",[240,241,243],"h2",{"id":242},"prerequisites","Prerequisites",[245,246,247],"ul",{},[248,249,250],"li",{},"Nuxt v4.0+",[240,252,254],{"id":253},"add-to-project","Add to project",[256,257,258,263,289,293,313,320,329,332,341,344,347,367,376,384,387,396,400,419,422,443,446,523],"steps",{},[259,260,262],"h3",{"id":261},"install-the-module","Install the module",[161,264,268],{"className":265,"code":266,"language":267,"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,269,270],{"__ignoreMap":167},[172,271,272,276,280,283,286],{"class":174,"line":175},[172,273,275],{"class":274},"siqUp","npx",[172,277,279],{"class":278},"sI3kV"," nuxi",[172,281,282],{"class":278}," module",[172,284,285],{"class":278}," add",[172,287,288],{"class":278}," @onmax/nuxt-better-auth@alpha\n",[259,290,292],{"id":291},"set-environment-variables","Set Environment Variables",[294,295,296,297,300,301,304,305,308,309,312],"tip",{"icon":11},"When you install the module with ",[169,298,299],{},"nuxi module add",", it prompts you to generate ",[169,302,303],{},"NUXT_BETTER_AUTH_SECRET"," and can append it to your ",[169,306,307],{},".env",". ",[169,310,311],{},"BETTER_AUTH_SECRET"," still works as a compatibility fallback. In CI/test environments it auto-generates the secret.",[314,315,316,317,319],"p",{},"Add these environment variables to ",[169,318,307],{},":",[321,322,323],"ol",{},[248,324,325],{},[326,327,328],"strong",{},"Secret Key",[314,330,331],{},"The secret encrypts and hashes sensitive data. Must be at least 32 characters with high entropy.",[161,333,335],{"className":163,"code":334,"filename":307,"language":166,"meta":167,"style":167},"NUXT_BETTER_AUTH_SECRET=\n",[169,336,337],{"__ignoreMap":167},[172,338,339],{"class":174,"line":175},[172,340,334],{},[342,343],"generate-secret",{},[314,345,346],{},"Or generate via terminal:",[161,348,350],{"className":265,"code":349,"language":267,"meta":167,"style":167},"openssl rand -base64 32\n",[169,351,352],{"__ignoreMap":167},[172,353,354,357,360,364],{"class":174,"line":175},[172,355,356],{"class":274},"openssl",[172,358,359],{"class":278}," rand",[172,361,363],{"class":362},"s3ZNE"," -base64",[172,365,366],{"class":362}," 32\n",[294,368,369,370,372,373,375],{},"Use ",[169,371,303],{}," for Nuxt runtime config and multi-environment deployments. ",[169,374,311],{}," remains supported as a fallback.",[321,377,378],{"start":181},[248,379,380,383],{},[326,381,382],{},"Base URL"," (Optional)",[314,385,386],{},"The module auto-detects the URL on Vercel, Cloudflare Pages, and Netlify. Set manually for other platforms.",[161,388,390],{"className":163,"code":389,"filename":307,"language":166,"meta":167,"style":167},"NUXT_PUBLIC_SITE_URL=https://your-domain.com\n",[169,391,392],{"__ignoreMap":167},[172,393,394],{"class":174,"line":175},[172,395,389],{},[259,397,399],{"id":398},"create-configuration-files","Create Configuration Files",[294,401,402,403,406,407,410,411,414,415,418],{"icon":11},"During module install, ",[169,404,405],{},"server/auth.config.ts"," and ",[169,408,409],{},"\u003CsrcDir>/auth.config.ts"," are scaffolded if missing. The client config is placed in your ",[169,412,413],{},"srcDir"," (e.g., ",[169,416,417],{},"app/"," or project root).",[314,420,421],{},"The module requires two configuration files:",[321,423,424,432],{},[248,425,426,429,430],{},[326,427,428],{},"Server Configuration",": ",[169,431,405],{},[248,433,434,429,437,414,439,442],{},[326,435,436],{},"Client Configuration",[169,438,409],{},[169,440,441],{},"app/auth.config.ts",")",[314,444,445],{},"Create these files with the following content:",[161,447,451],{"className":448,"code":449,"filename":405,"language":450,"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,452,453,477,481,497,518],{"__ignoreMap":167},[172,454,455,459,463,467,470,473],{"class":174,"line":175},[172,456,458],{"class":457},"sqe1H","import",[172,460,462],{"class":461},"s17Py"," { ",[172,464,466],{"class":465},"sYvLG","defineServerAuth",[172,468,469],{"class":461}," } ",[172,471,472],{"class":457},"from",[172,474,476],{"class":475},"sPAZv"," '@onmax/nuxt-better-auth/config'\n",[172,478,479],{"class":174,"line":181},[172,480,185],{"emptyLinePlaceholder":184},[172,482,483,486,490,494],{"class":174,"line":188},[172,484,485],{"class":457},"export",[172,487,489],{"class":488},"sKg8T"," default",[172,491,493],{"class":492},"sfT9l"," defineServerAuth",[172,495,496],{"class":461},"({\n",[172,498,499,502,505,507,510,512,515],{"class":174,"line":194},[172,500,501],{"class":465},"  emailAndPassword",[172,503,319],{"class":504},"sVnqq",[172,506,462],{"class":461},[172,508,509],{"class":465},"enabled",[172,511,319],{"class":504},[172,513,514],{"class":362}," true",[172,516,517],{"class":461}," }\n",[172,519,520],{"class":174,"line":200},[172,521,522],{"class":461},"})\n",[161,524,526],{"className":448,"code":525,"filename":441,"language":450,"meta":167,"style":167},"import { defineClientAuth } from '@onmax/nuxt-better-auth/config'\n\nexport default defineClientAuth({})\n",[169,527,528,543,547],{"__ignoreMap":167},[172,529,530,532,534,537,539,541],{"class":174,"line":175},[172,531,458],{"class":457},[172,533,462],{"class":461},[172,535,536],{"class":465},"defineClientAuth",[172,538,469],{"class":461},[172,540,472],{"class":457},[172,542,476],{"class":475},[172,544,545],{"class":174,"line":181},[172,546,185],{"emptyLinePlaceholder":184},[172,548,549,551,553,556],{"class":174,"line":188},[172,550,485],{"class":457},[172,552,489],{"class":488},[172,554,555],{"class":492}," defineClientAuth",[172,557,558],{"class":461},"({})\n",[560,561,562,565,566,570],"callout",{"icon":36,"to":117},[326,563,564],{},"Need database persistence?"," See ",[567,568,569],"a",{"href":117},"NuxtHub Integration"," for auto-generated schemas and full database support.",[560,572,574,577],{"icon":573,"to":83},"i-lucide-hard-drive",[326,575,576],{},"Bring your own database?"," Use Drizzle, Prisma, or Kysely adapters with any database.",[579,580,581],"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":583},[584,585],{"id":242,"depth":181,"text":243},{"id":253,"depth":181,"text":254,"children":586},[587,588,589],{"id":261,"depth":188,"text":262},{"id":291,"depth":188,"text":292},{"id":398,"depth":188,"text":399},"Learn how to add Nuxt Better Auth to your Nuxt project.","md",null,{},{"icon":16},{"title":13,"description":590},"xE_tW7pelkg5oMbAHvD4zkQOdki1oOZOPkSbsoE6uHg",[598,600],{"title":10,"path":6,"stem":7,"description":599,"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":601,"icon":21,"children":-1},"Configure the module options and your Better Auth server instance.",1775080951679]