[{"data":1,"prerenderedAt":468},["ShallowReactive",2],{"navigation_docs":3,"-getting-started-how-it-works":208,"-getting-started-how-it-works-surround":463},[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":38,"body":210,"description":456,"extension":457,"links":458,"meta":459,"navigation":460,"path":39,"seo":461,"stem":40,"__hash__":462},"docs\u002F1.getting-started\u002F6.how-it-works.md",{"type":211,"value":212,"toc":443},"minimark",[213,217,222,268,272,374,378,416,420],[214,215,216],"p",{},"Use this page after installation. It explains how the module connects Nuxt runtime behavior to Better Auth rather than walking through setup again.",[218,219,221],"h2",{"id":220},"architecture","Architecture",[223,224,225,230,243,247,257,261],"steps",{},[226,227,229],"h3",{"id":228},"initialization","Initialization",[214,231,232,233,237,238,242],{},"During build, the module reads ",[234,235,236],"code",{},"server\u002Fauth.config.ts"," and generates the auth handler. If using ",[239,240],"brand-badge",{"name":241},"nuxthub",", it also generates the database schema automatically.",[226,244,246],{"id":245},"server-runtime","Server Runtime",[214,248,249,250,253,254,256],{},"The module injects a catch-all API handler at ",[234,251,252],{},"\u002Fapi\u002Fauth\u002F**",". This handler processes all authentication requests (login, logout, session fetching) using the configuration provided in ",[234,255,236],{},".",[226,258,260],{"id":259},"client-runtime","Client Runtime",[214,262,263,264,267],{},"On the client side, ",[234,265,266],{},"useUserSession"," initializes the Better Auth client. It establishes a reactive connection to the session state, ensuring that your UI updates immediately when a user logs in or out.",[218,269,271],{"id":270},"key-responsibilities","Key Responsibilities",[273,274,275,291],"table",{},[276,277,278],"thead",{},[279,280,281,285,288],"tr",{},[282,283,284],"th",{},"Feature",[282,286,287],{},"What it provides",[282,289,290],{},"Side",[292,293,294,309,322,339,356],"tbody",{},[279,295,296,300,306],{},[297,298,299],"td",{},"Server handler",[297,301,302,303],{},"Mounts Better Auth at ",[234,304,305],{},"\u002Fapi\u002Fauth\u002F*",[297,307,308],{},"Server",[279,310,311,313,319],{},[297,312,142],{},[297,314,315,318],{},[234,316,317],{},"useUserSession()"," for reactive state",[297,320,321],{},"Client",[279,323,324,327,337],{},[297,325,326],{},"Server utils",[297,328,329,332,333,336],{},[234,330,331],{},"serverAuth(event?)",", ",[234,334,335],{},"getUserSession(event)",", etc.",[297,338,308],{},[279,340,341,344,353],{},[297,342,343],{},"Route protection",[297,345,346,349,350],{},[234,347,348],{},"routeRules.auth"," and ",[234,351,352],{},"definePageMeta({ auth })",[297,354,355],{},"Both",[279,357,358,361,371],{},[297,359,360],{},"Type augmentation",[297,362,363,364,349,367,370],{},"Inferred ",[234,365,366],{},"AuthUser",[234,368,369],{},"AuthSession"," types",[297,372,373],{},"Build",[218,375,377],{"id":376},"request-flow","Request Flow",[379,380,381,385,396,399,405,408,411],"ol",{},[382,383,384],"li",{},"User visits a protected page",[382,386,387,388,391,392,395],{},"Route middleware checks ",[234,389,390],{},"auth"," rule in ",[234,393,394],{},"routeRules"," or page meta",[382,397,398],{},"If not authenticated, redirects to login page",[382,400,401,402],{},"User submits credentials to ",[234,403,404],{},"\u002Fapi\u002Fauth\u002Fsign-in\u002Femail",[382,406,407],{},"Better Auth validates credentials and creates session",[382,409,410],{},"Session cookie is set, user redirected to original page",[382,412,413,415],{},[234,414,317],{}," reads session from cookie, updates reactive state",[218,417,419],{"id":418},"what-this-means-in-practice","What this means in practice",[421,422,423,429,435,438],"ul",{},[382,424,425,426,428],{},"client pages use ",[234,427,317],{}," and related composables",[382,430,431,432],{},"protected API routes should still call ",[234,433,434],{},"requireUserSession(event)",[382,436,437],{},"route rules improve navigation UX, but server-side checks remain the real security boundary",[382,439,440,442],{},[239,441],{"name":241}," integration and schema generation are build-time concerns, not request-time concerns",{"title":444,"searchDepth":445,"depth":445,"links":446},"",2,[447,453,454,455],{"id":220,"depth":445,"text":221,"children":448},[449,451,452],{"id":228,"depth":450,"text":229},3,{"id":245,"depth":450,"text":246},{"id":259,"depth":450,"text":260},{"id":270,"depth":445,"text":271},{"id":376,"depth":445,"text":377},{"id":418,"depth":445,"text":419},"Understand the architecture after completing setup.","md",null,{},{"icon":41},{"title":38,"description":456},"4pDwAR4dANKn7Dpbpxda5EKCVCZiUCOOeyLuH85liGk",[464,466],{"title":33,"path":34,"stem":35,"description":465,"icon":36,"children":-1},"Auto-generate Drizzle ORM schemas for Better Auth tables when using NuxtHub.",{"title":48,"path":49,"stem":50,"description":467,"children":-1},"When to reach for the full Better Auth server instance.",1791215142164]