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