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