[{"data":1,"prerenderedAt":671},["ShallowReactive",2],{"navigation_docs":3,"-getting-started":208,"-getting-started-surround":668},[4,42,68,115,136,157],{"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,82,86,90,94,99,103,107,111],{"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,"icon":81},"Setup diagnostics","\u002Fguides\u002Fdiagnostics","3.guides\u002F10.diagnostics","i-lucide-circle-alert",{"title":83,"path":84,"stem":85},"OAuth Providers","\u002Fguides\u002Foauth-providers","3.guides\u002F2.oauth-providers",{"title":87,"path":88,"stem":89},"Custom Database","\u002Fguides\u002Fcustom-database","3.guides\u002F3.custom-database",{"title":91,"path":92,"stem":93},"Database-less Mode","\u002Fguides\u002Fdatabase-less-mode","3.guides\u002F4.database-less-mode",{"title":95,"path":96,"stem":97,"icon":98},"External Auth Backend","\u002Fguides\u002Fexternal-auth-backend","3.guides\u002F5.external-auth-backend","i-lucide-server",{"title":100,"path":101,"stem":102},"Migrating from nuxt-auth-utils","\u002Fguides\u002Fmigrate-from-nuxt-auth-utils","3.guides\u002F6.migrate-from-nuxt-auth-utils",{"title":104,"path":105,"stem":106},"Two-Factor Authentication (TOTP + Backup Codes)","\u002Fguides\u002Ftwo-factor-auth","3.guides\u002F7.two-factor-auth",{"title":108,"path":109,"stem":110},"Testing","\u002Fguides\u002Ftesting","3.guides\u002F8.testing",{"title":112,"path":113,"stem":114},"Production Deployment","\u002Fguides\u002Fproduction-deployment","3.guides\u002F9.production-deployment",{"title":116,"path":117,"stem":118,"children":119,"page":67},"Integrations","\u002Fintegrations","4.integrations",[120,124,128,132],{"title":121,"path":122,"stem":123},"NuxtHub","\u002Fintegrations\u002Fnuxthub","4.integrations\u002F1.nuxthub",{"title":125,"path":126,"stem":127},"DevTools","\u002Fintegrations\u002Fdevtools","4.integrations\u002F2.devtools",{"title":129,"path":130,"stem":131},"Convex","\u002Fintegrations\u002Fconvex","4.integrations\u002F3.convex",{"title":133,"path":134,"stem":135},"i18n","\u002Fintegrations\u002Fi18n","4.integrations\u002F4.i18n",{"title":137,"path":138,"stem":139,"children":140,"page":67},"API Reference","\u002Fapi","5.api",[141,145,149,153],{"title":142,"path":143,"stem":144},"Composables","\u002Fapi\u002Fcomposables","5.api\u002F1.composables",{"title":146,"path":147,"stem":148},"Server Utilities","\u002Fapi\u002Fserver-utils","5.api\u002F2.server-utils",{"title":150,"path":151,"stem":152},"Components","\u002Fapi\u002Fcomponents","5.api\u002F3.components",{"title":154,"path":155,"stem":156},"Types","\u002Fapi\u002Ftypes","5.api\u002F4.types",{"title":158,"path":159,"stem":160,"children":161,"icon":81},"Errors","\u002Ferrors","6.errors\u002F0.index",[162,164,168,172,176,180,184,188,192,196,200,204],{"title":163,"path":159,"stem":160},"Overview",{"title":165,"path":166,"stem":167},"Auth configuration failed to load","\u002Ferrors\u002Fnuxt-auth-config-load-failed","6.errors\u002Fnuxt-auth-config-load-failed",{"title":169,"path":170,"stem":171},"Schema generator returned no code","\u002Ferrors\u002Fnuxt-auth-empty-schema","6.errors\u002Fnuxt-auth-empty-schema",{"title":173,"path":174,"stem":175},"Invalid server auth config export","\u002Ferrors\u002Fnuxt-auth-invalid-config-export","6.errors\u002Fnuxt-auth-invalid-config-export",{"title":177,"path":178,"stem":179},"Auth plugin path must be absolute","\u002Ferrors\u002Fnuxt-auth-invalid-plugin-source","6.errors\u002Fnuxt-auth-invalid-plugin-source",{"title":181,"path":182,"stem":183},"Missing auth configuration","\u002Ferrors\u002Fnuxt-auth-missing-config","6.errors\u002Fnuxt-auth-missing-config",{"title":185,"path":186,"stem":187},"NuxtHub database alias is missing","\u002Ferrors\u002Fnuxt-auth-missing-hub-db","6.errors\u002Fnuxt-auth-missing-hub-db",{"title":189,"path":190,"stem":191},"No database provider is enabled","\u002Ferrors\u002Fnuxt-auth-no-database-provider","6.errors\u002Fnuxt-auth-no-database-provider",{"title":193,"path":194,"stem":195},"Auth schema generation failed","\u002Ferrors\u002Fnuxt-auth-schema-generation-failed","6.errors\u002Fnuxt-auth-schema-generation-failed",{"title":197,"path":198,"stem":199},"Custom session storage is missing","\u002Ferrors\u002Fnuxt-auth-schema-storage-required","6.errors\u002Fnuxt-auth-schema-storage-required",{"title":201,"path":202,"stem":203},"Secondary storage in client-only mode","\u002Ferrors\u002Fnuxt-auth-storage-client-only","6.errors\u002Fnuxt-auth-storage-client-only",{"title":205,"path":206,"stem":207},"Unsupported database dialect","\u002Ferrors\u002Fnuxt-auth-unsupported-dialect","6.errors\u002Fnuxt-auth-unsupported-dialect",{"id":209,"title":10,"body":210,"description":661,"extension":662,"links":663,"meta":664,"navigation":665,"path":6,"seo":666,"stem":7,"__hash__":667},"docs\u002F1.getting-started\u002F0.index.md",{"type":211,"value":212,"toc":648},"minimark",[213,217,220,237,254,259,262,296,300,315,319,574,578,581,599,609,613,644],[214,215,216],"p",{},"Use this page when you want the fastest path to a working Nuxt setup.",[214,218,219],{},"This quickstart assumes:",[221,222,223,227,234],"ul",{},[224,225,226],"li",{},"you want the default full-mode setup",[224,228,229,230],{},"you are using ",[231,232,233],"code",{},"pnpm",[224,235,236],{},"you want a local login flow working before you customize providers or plugins",[214,238,239,240,244,245,249,250,253],{},"If you already know you need a different architecture, jump to ",[241,242],"brand-badge",{"name":243,"to":122},"nuxthub",", ",[246,247,248],"a",{"href":88},"custom database",", or ",[246,251,252],{"href":96},"external auth backend",".",[255,256,258],"h2",{"id":257},"what-you-will-end-up-with","What you will end up with",[214,260,261],{},"After this guide you should have:",[221,263,264,273,279,289],{},[224,265,266,269,270],{},[231,267,268],{},"server\u002Fauth.config.ts"," and ",[231,271,272],{},"app\u002Fauth.config.ts",[224,274,275,276],{},"Better Auth handlers mounted at ",[231,277,278],{},"\u002Fapi\u002Fauth\u002F*",[224,280,281,282,285,286],{},"a valid auth secret: ",[231,283,284],{},"NUXT_APP_SECRET"," on Nuxt 4.6+, or ",[231,287,288],{},"NUXT_BETTER_AUTH_SECRET",[224,290,291,292,295],{},"a reactive ",[231,293,294],{},"useUserSession()"," composable in your app",[255,297,299],{"id":298},"before-you-begin","Before you begin",[221,301,302,309],{},[224,303,304,305,308],{},"a local ",[231,306,307],{},".env"," file",[224,310,311,312],{},"a development server you can start with ",[231,313,314],{},"pnpm dev",[255,316,318],{"id":317},"quickstart","Quickstart",[320,321,322,327,358,362,368,405,426,430,518,522,558,562],"steps",{},[323,324,326],"h3",{"id":325},"install-the-module","Install the module",[328,329,334],"pre",{"className":330,"code":331,"language":332,"meta":333,"style":333},"language-bash shiki shiki-themes one-light synthwave-84 synthwave-84","npx nuxi module add @nuxtjs\u002Fbetter-auth\n","bash","",[231,335,336],{"__ignoreMap":333},[337,338,341,345,349,352,355],"span",{"class":339,"line":340},"line",1,[337,342,344],{"class":343},"siqUp","npx",[337,346,348],{"class":347},"sI3kV"," nuxi",[337,350,351],{"class":347}," module",[337,353,354],{"class":347}," add",[337,356,357],{"class":347}," @nuxtjs\u002Fbetter-auth\n",[323,359,361],{"id":360},"add-your-secret","Add your secret",[214,363,364,365,367],{},"Create or update ",[231,366,307],{},":",[328,369,373],{"className":370,"code":371,"filename":307,"language":372,"meta":333,"style":333},"language-ini shiki shiki-themes one-light synthwave-84 synthwave-84","# Nuxt 4.6 and newer\nNUXT_APP_SECRET=\"replace-with-a-random-32-character-secret\"\n\n# Nuxt 4.5 and older\n# NUXT_BETTER_AUTH_SECRET=\"replace-with-a-random-32-character-secret\"\n","ini",[231,374,375,380,386,393,399],{"__ignoreMap":333},[337,376,377],{"class":339,"line":340},[337,378,379],{},"# Nuxt 4.6 and newer\n",[337,381,383],{"class":339,"line":382},2,[337,384,385],{},"NUXT_APP_SECRET=\"replace-with-a-random-32-character-secret\"\n",[337,387,389],{"class":339,"line":388},3,[337,390,392],{"emptyLinePlaceholder":391},true,"\n",[337,394,396],{"class":339,"line":395},4,[337,397,398],{},"# Nuxt 4.5 and older\n",[337,400,402],{"class":339,"line":401},5,[337,403,404],{},"# NUXT_BETTER_AUTH_SECRET=\"replace-with-a-random-32-character-secret\"\n",[214,406,407,408,411,412,244,414,417,418,421,422,425],{},"Use a high-entropy value. On Nuxt 4.6+, the module derives its auth secret from Nuxt's ",[231,409,410],{},"appSecret"," when no auth secret is configured. ",[231,413,288],{},[231,415,416],{},"BETTER_AUTH_SECRET",", and Better Auth's versioned ",[231,419,420],{},"BETTER_AUTH_SECRETS","\u002F",[231,423,424],{},"secrets"," configuration override it, and one of them is required on older Nuxt versions.",[323,427,429],{"id":428},"create-the-server-config","Create the server config",[328,431,435],{"className":432,"code":433,"filename":268,"language":434,"meta":333,"style":333},"language-ts shiki shiki-themes one-light synthwave-84 synthwave-84","import { defineServerAuth } from '@nuxtjs\u002Fbetter-auth\u002Fconfig'\n\nexport default defineServerAuth({\n  emailAndPassword: {\n    enabled: true,\n  },\n})\n","ts",[231,436,437,461,465,481,492,506,512],{"__ignoreMap":333},[337,438,439,443,447,451,454,457],{"class":339,"line":340},[337,440,442],{"class":441},"sqe1H","import",[337,444,446],{"class":445},"s17Py"," { ",[337,448,450],{"class":449},"sYvLG","defineServerAuth",[337,452,453],{"class":445}," } ",[337,455,456],{"class":441},"from",[337,458,460],{"class":459},"sPAZv"," '@nuxtjs\u002Fbetter-auth\u002Fconfig'\n",[337,462,463],{"class":339,"line":382},[337,464,392],{"emptyLinePlaceholder":391},[337,466,467,470,474,478],{"class":339,"line":388},[337,468,469],{"class":441},"export",[337,471,473],{"class":472},"sKg8T"," default",[337,475,477],{"class":476},"sfT9l"," defineServerAuth",[337,479,480],{"class":445},"({\n",[337,482,483,486,489],{"class":339,"line":395},[337,484,485],{"class":449},"  emailAndPassword",[337,487,367],{"class":488},"sVnqq",[337,490,491],{"class":445}," {\n",[337,493,494,497,499,503],{"class":339,"line":401},[337,495,496],{"class":449},"    enabled",[337,498,367],{"class":488},[337,500,502],{"class":501},"s3ZNE"," true",[337,504,505],{"class":445},",\n",[337,507,509],{"class":339,"line":508},6,[337,510,511],{"class":445},"  },\n",[337,513,515],{"class":339,"line":514},7,[337,516,517],{"class":445},"})\n",[323,519,521],{"id":520},"create-the-client-config","Create the client config",[328,523,525],{"className":432,"code":524,"filename":272,"language":434,"meta":333,"style":333},"import { defineClientAuth } from '@nuxtjs\u002Fbetter-auth\u002Fconfig'\n\nexport default defineClientAuth({})\n",[231,526,527,542,546],{"__ignoreMap":333},[337,528,529,531,533,536,538,540],{"class":339,"line":340},[337,530,442],{"class":441},[337,532,446],{"class":445},[337,534,535],{"class":449},"defineClientAuth",[337,537,453],{"class":445},[337,539,456],{"class":441},[337,541,460],{"class":459},[337,543,544],{"class":339,"line":382},[337,545,392],{"emptyLinePlaceholder":391},[337,547,548,550,552,555],{"class":339,"line":388},[337,549,469],{"class":441},[337,551,473],{"class":472},[337,553,554],{"class":476}," defineClientAuth",[337,556,557],{"class":445},"({})\n",[323,559,561],{"id":560},"start-nuxt","Start Nuxt",[328,563,565],{"className":330,"code":564,"language":332,"meta":333,"style":333},"pnpm dev\n",[231,566,567],{"__ignoreMap":333},[337,568,569,571],{"class":339,"line":340},[337,570,233],{"class":343},[337,572,573],{"class":347}," dev\n",[255,575,577],{"id":576},"verify-the-result","Verify the result",[214,579,580],{},"Check these success signals:",[221,582,583,586,591,596],{},[224,584,585],{},"your app starts without auth-related module errors",[224,587,588,590],{},[231,589,278],{}," routes are registered",[224,592,593,595],{},[231,594,294],{}," is available in a page or component",[224,597,598],{},"the generated config files match your project structure",[214,600,601,602,605,606,253],{},"If you use a custom ",[231,603,604],{},"srcDir",", the client config lives there instead of ",[231,607,608],{},"app\u002F",[255,610,612],{"id":611},"next-steps","Next steps",[614,615,616,623,630,637],"ol",{},[224,617,618,619,622],{},"Follow ",[246,620,621],{"href":14},"installation"," for the complete setup checklist.",[224,624,625,626,629],{},"Read ",[246,627,628],{"href":19},"configuration"," before adding providers or plugins.",[224,631,632,633,636],{},"Set up ",[246,634,635],{"href":24},"client usage"," in your pages and forms.",[224,638,639,640,643],{},"Add ",[246,641,642],{"href":57},"route protection"," once the login flow works.",[645,646,647],"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 .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}html pre.shiki code .s3ZNE, html code.shiki .s3ZNE{--shiki-light:#986801;--shiki-default:#F97E72;--shiki-dark:#F97E72}",{"title":333,"searchDepth":382,"depth":382,"links":649},[650,651,652,659,660],{"id":257,"depth":382,"text":258},{"id":298,"depth":382,"text":299},{"id":317,"depth":382,"text":318,"children":653},[654,655,656,657,658],{"id":325,"depth":388,"text":326},{"id":360,"depth":388,"text":361},{"id":428,"depth":388,"text":429},{"id":520,"depth":388,"text":521},{"id":560,"depth":388,"text":561},{"id":576,"depth":382,"text":577},{"id":611,"depth":382,"text":612},"Nuxt Better Auth integrates Better Auth with Nuxt for route protection, session management, and schema generation.","md",null,{},{"icon":11},{"title":10,"description":661},"jzsGXfuJM4lFbN7dYgbsIv1BH_2xZq55U4Oor6X7nlY",[663,669],{"title":13,"path":14,"stem":15,"description":670,"icon":16,"children":-1},"Learn how to add Nuxt Better Auth to your Nuxt project.",1791297056137]