[{"data":1,"prerenderedAt":732},["ShallowReactive",2],{"navigation_docs":3,"-core-concepts-auto-imports-aliases":216,"-core-concepts-auto-imports-aliases-surround":727},[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":60,"body":218,"description":721,"extension":722,"links":723,"meta":724,"navigation":248,"path":61,"seo":725,"stem":62,"__hash__":726},"docs\u002F2.core-concepts\u002F4.auto-imports-aliases.md",{"type":219,"value":220,"toc":712},"minimark",[221,280,284,289,295,354,359,406,410,417,421,430,551,573,581,585,654,665,669,708],[222,223,224],"code-collapse",{},[225,226,232],"pre",{"className":227,"code":228,"filename":229,"language":230,"meta":231,"style":231},"language-txt shiki shiki-themes one-light synthwave-84 synthwave-84","Use auto-imported utilities from @nuxtjs\u002Fbetter-auth.\n\n- Client (auto-imported in Vue): `useUserSession()`, `useUserSessionState()`, `useAuthClient()`, `useSignIn()`, `useSignUp()`, `useSignOut()`, `useAction()`, `useAuthClientAction()`, `useAuthRequestFetch()`, `useAuthAsyncData()`, `runWithSessionRefresh()`\n- Server (auto-imported in `server\u002F`): `serverAuth(event?)`, `ensureServerAuth(event?)`, `getRequestSession(event)`, `setRequestSession(event, session)`, `getUserSession(event)`, `refreshSessionCookieCache(event)`, `createSession(event, userId)`, `setSessionCookie(event, token)`, `requireUserSession(event, options?)`\n- Component: `\u003CBetterAuthState>` for auth-ready rendering\n- Alias `#nuxt-better-auth` exports types: `AuthUser`, `AuthSession`, `AuthSocialProviderId`\n- Use `getRequestSession(event)` over repeated `getUserSession(event)` calls — it caches per request\n","Prompt","txt","",[233,234,235,243,250,256,262,268,274],"code",{"__ignoreMap":231},[236,237,240],"span",{"class":238,"line":239},"line",1,[236,241,242],{},"Use auto-imported utilities from @nuxtjs\u002Fbetter-auth.\n",[236,244,246],{"class":238,"line":245},2,[236,247,249],{"emptyLinePlaceholder":248},true,"\n",[236,251,253],{"class":238,"line":252},3,[236,254,255],{},"- Client (auto-imported in Vue): `useUserSession()`, `useUserSessionState()`, `useAuthClient()`, `useSignIn()`, `useSignUp()`, `useSignOut()`, `useAction()`, `useAuthClientAction()`, `useAuthRequestFetch()`, `useAuthAsyncData()`, `runWithSessionRefresh()`\n",[236,257,259],{"class":238,"line":258},4,[236,260,261],{},"- Server (auto-imported in `server\u002F`): `serverAuth(event?)`, `ensureServerAuth(event?)`, `getRequestSession(event)`, `setRequestSession(event, session)`, `getUserSession(event)`, `refreshSessionCookieCache(event)`, `createSession(event, userId)`, `setSessionCookie(event, token)`, `requireUserSession(event, options?)`\n",[236,263,265],{"class":238,"line":264},5,[236,266,267],{},"- Component: `\u003CBetterAuthState>` for auth-ready rendering\n",[236,269,271],{"class":238,"line":270},6,[236,272,273],{},"- Alias `#nuxt-better-auth` exports types: `AuthUser`, `AuthSession`, `AuthSocialProviderId`\n",[236,275,277],{"class":238,"line":276},7,[236,278,279],{},"- Use `getRequestSession(event)` over repeated `getUserSession(event)` calls — it caches per request\n",[281,282,283],"p",{},"Use this page when you want a quick inventory of what the module registers for you and where each helper is available.",[285,286,288],"h2",{"id":287},"autoimports","Auto‑imports",[281,290,291],{},[292,293,294],"strong",{},"Client",[296,297,298,304,309,314,319,324,329,334,339,344,349],"ul",{},[299,300,301],"li",{},[233,302,303],{},"useUserSession()",[299,305,306],{},[233,307,308],{},"useUserSessionState()",[299,310,311],{},[233,312,313],{},"useAuthClient()",[299,315,316],{},[233,317,318],{},"useSignIn()",[299,320,321],{},[233,322,323],{},"useSignUp()",[299,325,326],{},[233,327,328],{},"useSignOut()",[299,330,331],{},[233,332,333],{},"useAction()",[299,335,336],{},[233,337,338],{},"useAuthClientAction()",[299,340,341],{},[233,342,343],{},"useAuthRequestFetch()",[299,345,346],{},[233,347,348],{},"useAuthAsyncData()",[299,350,351],{},[233,352,353],{},"runWithSessionRefresh()",[281,355,356],{},[292,357,358],{},"Server",[296,360,361,366,371,376,381,386,391,396,401],{},[299,362,363],{},[233,364,365],{},"serverAuth(event?)",[299,367,368],{},[233,369,370],{},"ensureServerAuth(event?)",[299,372,373],{},[233,374,375],{},"getRequestSession(event)",[299,377,378],{},[233,379,380],{},"setRequestSession(event, session)",[299,382,383],{},[233,384,385],{},"getUserSession(event)",[299,387,388],{},[233,389,390],{},"refreshSessionCookieCache(event)",[299,392,393],{},[233,394,395],{},"createSession(event, userId)",[299,397,398],{},[233,399,400],{},"setSessionCookie(event, token)",[299,402,403],{},[233,404,405],{},"requireUserSession(event, options?)",[281,407,408],{},[292,409,150],{},[296,411,412],{},[299,413,414],{},[233,415,416],{},"\u003CBetterAuthState>",[285,418,420],{"id":419},"usage-examples","Usage Examples",[422,423,425,426,429],"h3",{"id":424},"server-utils-auto-imported-in-server","Server Utils (auto-imported in ",[233,427,428],{},"server\u002F",")",[225,431,436],{"className":432,"code":433,"filename":434,"language":435,"meta":231,"style":231},"language-ts shiki shiki-themes one-light synthwave-84 synthwave-84","export default defineEventHandler(async (event) => {\n  \u002F\u002F These are auto-imported, no import statement needed\n  const requestSession = await getRequestSession(event)\n  const session = await getUserSession(event)\n  const auth = serverAuth(event)\n})\n","server\u002Fapi\u002Fprofile.ts","ts",[233,437,438,475,481,508,528,546],{"__ignoreMap":231},[236,439,440,444,448,452,456,459,462,466,469,472],{"class":238,"line":239},[236,441,443],{"class":442},"sqe1H","export",[236,445,447],{"class":446},"sKg8T"," default",[236,449,451],{"class":450},"sfT9l"," defineEventHandler",[236,453,455],{"class":454},"s17Py","(",[236,457,458],{"class":442},"async",[236,460,461],{"class":454}," (",[236,463,465],{"class":464},"sgisi","event",[236,467,468],{"class":454},") ",[236,470,471],{"class":442},"=>",[236,473,474],{"class":454}," {\n",[236,476,477],{"class":238,"line":245},[236,478,480],{"class":479},"st7cf","  \u002F\u002F These are auto-imported, no import statement needed\n",[236,482,483,486,490,494,497,500,502,505],{"class":238,"line":252},[236,484,485],{"class":442},"  const",[236,487,489],{"class":488},"s6Rhl"," requestSession",[236,491,493],{"class":492},"sQBpM"," =",[236,495,496],{"class":442}," await",[236,498,499],{"class":450}," getRequestSession",[236,501,455],{"class":454},[236,503,465],{"class":504},"sYvLG",[236,506,507],{"class":454},")\n",[236,509,510,512,515,517,519,522,524,526],{"class":238,"line":258},[236,511,485],{"class":442},[236,513,514],{"class":488}," session",[236,516,493],{"class":492},[236,518,496],{"class":442},[236,520,521],{"class":450}," getUserSession",[236,523,455],{"class":454},[236,525,465],{"class":504},[236,527,507],{"class":454},[236,529,530,532,535,537,540,542,544],{"class":238,"line":264},[236,531,485],{"class":442},[236,533,534],{"class":488}," auth",[236,536,493],{"class":492},[236,538,539],{"class":450}," serverAuth",[236,541,455],{"class":454},[236,543,465],{"class":504},[236,545,507],{"class":454},[236,547,548],{"class":238,"line":270},[236,549,550],{"class":454},"})\n",[281,552,553,554,556,557,559,560,562,563,566,567,569,570,572],{},"Use ",[233,555,375],{}," when multiple handlers or middleware in the same request need session data. The helper should be preferred over repeated ",[233,558,385],{}," calls in the same request chain.\nUse ",[233,561,380],{}," after trusted server code authenticates a request and resolves a complete ",[233,564,565],{},"AppSession"," that downstream session helpers should reuse. The value applies only to the current request and does not set a session cookie.\n",[233,568,385],{}," does not memoize by itself.\nUse ",[233,571,390],{}," after server-side code updates data returned by the Better Auth session. This refreshes the cached session cookie. It does not update the session or user record; perform that update first.",[281,574,553,575,577,578,580],{},[233,576,395],{}," when a custom server handler finishes its own verification logic and needs a Better Auth session record without reaching into module internals.\nUse ",[233,579,400],{}," when a custom server handler completes its own verification step and needs to attach a Better Auth session cookie to the response.",[422,582,584],{"id":583},"client-composables-auto-imported-in-vue-components","Client Composables (auto-imported in Vue components)",[225,586,591],{"className":587,"code":588,"filename":589,"language":590,"meta":231,"style":231},"language-vue shiki shiki-themes one-light synthwave-84 synthwave-84","\u003Cscript setup>\n\u002F\u002F Auto-imported, no import statement needed\nconst { user, loggedIn } = useUserSession()\n\u003C\u002Fscript>\n","pages\u002Fdashboard.vue","vue",[233,592,593,610,615,645],{"__ignoreMap":231},[236,594,595,599,603,607],{"class":238,"line":239},[236,596,598],{"class":597},"sL9le","\u003C",[236,600,602],{"class":601},"stweg","script",[236,604,606],{"class":605},"s0frj"," setup",[236,608,609],{"class":597},">\n",[236,611,612],{"class":238,"line":245},[236,613,614],{"class":479},"\u002F\u002F Auto-imported, no import statement needed\n",[236,616,617,620,624,627,630,633,636,639,642],{"class":238,"line":252},[236,618,619],{"class":442},"const",[236,621,623],{"class":622},"sEEOt"," { ",[236,625,626],{"class":488},"user",[236,628,629],{"class":622},", ",[236,631,632],{"class":488},"loggedIn",[236,634,635],{"class":622}," } ",[236,637,638],{"class":492},"=",[236,640,641],{"class":450}," useUserSession",[236,643,644],{"class":622},"()\n",[236,646,647,650,652],{"class":238,"line":258},[236,648,649],{"class":597},"\u003C\u002F",[236,651,602],{"class":601},[236,653,609],{"class":597},[281,655,656,657,660,661,664],{},"For app code, prefer the auto-imports. For published reusable packages or Nuxt modules, import composables from ",[233,658,659],{},"@nuxtjs\u002Fbetter-auth\u002Fcomposables"," instead of ",[233,662,663],{},"#imports",".",[285,666,668],{"id":667},"aliases","Aliases",[670,671,672,685],"table",{},[673,674,675],"thead",{},[676,677,678,682],"tr",{},[679,680,681],"th",{},"Alias",[679,683,684],{},"Resolves to",[686,687,688],"tbody",{},[676,689,690,696],{},[691,692,693],"td",{},[233,694,695],{},"#nuxt-better-auth",[691,697,698,699,629,702,629,705,429],{},"Module types (",[233,700,701],{},"AuthUser",[233,703,704],{},"AuthSession",[233,706,707],{},"AuthSocialProviderId",[709,710,711],"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 .sqe1H, html code.shiki .sqe1H{--shiki-light:#A626A4;--shiki-default:#FEDE5D;--shiki-dark:#FEDE5D}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 .s17Py, html code.shiki .s17Py{--shiki-light:#383A42;--shiki-default:#BBBBBB;--shiki-dark:#BBBBBB}html pre.shiki code .sgisi, html code.shiki .sgisi{--shiki-light:#383A42;--shiki-light-font-style:inherit;--shiki-default:#FF7EDB;--shiki-default-font-style:italic;--shiki-dark:#FF7EDB;--shiki-dark-font-style:italic}html pre.shiki code .st7cf, html code.shiki .st7cf{--shiki-light:#A0A1A7;--shiki-light-font-style:italic;--shiki-default:#848BBD;--shiki-default-font-style:italic;--shiki-dark:#848BBD;--shiki-dark-font-style:italic}html pre.shiki code .s6Rhl, html code.shiki .s6Rhl{--shiki-light:#986801;--shiki-default:#FF7EDB;--shiki-dark:#FF7EDB}html pre.shiki code .sQBpM, html code.shiki .sQBpM{--shiki-light:#0184BC;--shiki-default:#FFFFFFEE;--shiki-dark:#FFFFFFEE}html pre.shiki code .sYvLG, html code.shiki .sYvLG{--shiki-light:#E45649;--shiki-default:#FF7EDB;--shiki-dark:#FF7EDB}html pre.shiki code .sL9le, html code.shiki .sL9le{--shiki-light:#383A42;--shiki-default:#36F9F6;--shiki-dark:#36F9F6}html pre.shiki code .stweg, html code.shiki .stweg{--shiki-light:#E45649;--shiki-default:#72F1B8;--shiki-dark:#72F1B8}html pre.shiki code .s0frj, html code.shiki .s0frj{--shiki-light:#986801;--shiki-light-font-style:inherit;--shiki-default:#FEDE5D;--shiki-default-font-style:italic;--shiki-dark:#FEDE5D;--shiki-dark-font-style:italic}html pre.shiki code .sEEOt, html code.shiki .sEEOt{--shiki-light:#383A42;--shiki-default:#FFFFFFEE;--shiki-dark:#FFFFFFEE}",{"title":231,"searchDepth":245,"depth":245,"links":713},[714,715,720],{"id":287,"depth":245,"text":288},{"id":419,"depth":245,"text":420,"children":716},[717,719],{"id":424,"depth":252,"text":718},"Server Utils (auto-imported in server\u002F)",{"id":583,"depth":252,"text":584},{"id":667,"depth":245,"text":668},"What the module registers for you.","md",null,{},{"title":60,"description":721},"_go-zCOdIYAiZDrtTr_xyeXYq57LgKujsYzTAnchRX0",[728,730],{"title":56,"path":57,"stem":58,"description":729,"children":-1},"Learn how to protect your pages and API routes using a layered approach.",{"title":64,"path":65,"stem":66,"description":731,"children":-1},"What is enforced where, and what you should not assume.",1792535506833]