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