[{"data":1,"prerenderedAt":320},["ShallowReactive",2],{"navigation_docs":3,"-core-concepts-sessions":129,"-core-concepts-sessions-surround":315},[4,34,63,80,101,110],{"title":5,"path":6,"stem":7,"children":8,"page":33},"Getting Started","/getting-started","1.getting-started",[9,13,17,21,25,29],{"title":10,"path":11,"stem":12},"Quickstart","/getting-started/quickstart","1.getting-started/0.quickstart",{"title":14,"path":15,"stem":16},"Installation","/getting-started/installation","1.getting-started/1.installation",{"title":18,"path":19,"stem":20},"Server Configuration","/getting-started/configuration","1.getting-started/2.configuration",{"title":22,"path":23,"stem":24},"Client Setup","/getting-started/client-setup","1.getting-started/3.client-setup",{"title":26,"path":27,"stem":28},"Type Augmentation","/getting-started/type-augmentation","1.getting-started/4.type-augmentation",{"title":30,"path":31,"stem":32},"Schema Generation","/getting-started/schema-generation","1.getting-started/5.schema-generation",false,{"title":35,"path":36,"stem":37,"children":38,"page":33},"Core Concepts","/core-concepts","2.core-concepts",[39,43,47,51,55,59],{"title":40,"path":41,"stem":42},"How It Works","/core-concepts/how-it-works","2.core-concepts/0.how-it-works",{"title":44,"path":45,"stem":46},"`serverAuth()`","/core-concepts/server-auth","2.core-concepts/1.server-auth",{"title":48,"path":49,"stem":50},"Sessions","/core-concepts/sessions","2.core-concepts/2.sessions",{"title":52,"path":53,"stem":54},"Route Protection","/core-concepts/route-protection","2.core-concepts/3.route-protection",{"title":56,"path":57,"stem":58},"Auto‑Imports and Aliases","/core-concepts/auto-imports-aliases","2.core-concepts/4.auto-imports-aliases",{"title":60,"path":61,"stem":62},"Security & Caveats","/core-concepts/security-caveats","2.core-concepts/5.security-caveats",{"title":64,"path":65,"stem":66,"children":67,"page":33},"Guides","/guides","3.guides",[68,72,76],{"title":69,"path":70,"stem":71},"Role‑Based Access","/guides/role-based-access","3.guides/1.role-based-access",{"title":73,"path":74,"stem":75},"Protecting API Routes","/guides/api-protection","3.guides/2.api-protection",{"title":77,"path":78,"stem":79},"Database Dialects","/guides/custom-dialects","3.guides/3.custom-dialects",{"title":81,"path":82,"stem":83,"children":84,"page":33},"API Reference","/api","4.api",[85,89,93,97],{"title":86,"path":87,"stem":88},"Composables","/api/composables","4.api/1.composables",{"title":90,"path":91,"stem":92},"Server Utilities","/api/server-utils","4.api/2.server-utils",{"title":94,"path":95,"stem":96},"Components","/api/components","4.api/3.components",{"title":98,"path":99,"stem":100},"Types","/api/types","4.api/4.types",{"title":102,"path":103,"stem":104,"children":105,"page":33},"Troubleshooting","/troubleshooting","5.troubleshooting",[106],{"title":107,"path":108,"stem":109},"FAQ","/troubleshooting/faq","5.troubleshooting/1.faq",{"title":111,"path":112,"stem":113,"children":114},"Better Auth","/better-auth","6.better-auth",[115,117,121,125],{"title":111,"path":112,"stem":116},"6.better-auth/index",{"title":118,"path":119,"stem":120},"OAuth & Social Providers","/better-auth/oauth","6.better-auth/1.oauth",{"title":122,"path":123,"stem":124},"Plugins","/better-auth/plugins","6.better-auth/2.plugins",{"title":126,"path":127,"stem":128},"Client Plugins (Exports)","/better-auth/client-plugins","6.better-auth/3.client-plugins",{"id":130,"title":48,"body":131,"description":308,"extension":309,"links":310,"meta":311,"navigation":312,"path":49,"seo":313,"stem":50,"__hash__":314},"docs/2.core-concepts/2.sessions.md",{"type":132,"value":133,"toc":304},"minimark",[134,142,246,251,275,285,289,300],[135,136,137,141],"p",{},[138,139,140],"code",{},"useUserSession()"," is auto‑imported on the client and server.",[143,144,149],"pre",{"className":145,"code":146,"language":147,"meta":148,"style":148},"language-ts shiki shiki-themes vitesse-light vitesse-dark vitesse-dark","const {\n  user,\n  session,\n  loggedIn,\n  ready,\n  signIn,\n  signUp,\n  signOut,\n  fetchSession,\n} = useUserSession()\n","ts","",[138,150,151,164,174,182,190,198,206,214,222,230],{"__ignoreMap":148},[152,153,156,160],"span",{"class":154,"line":155},"line",1,[152,157,159],{"class":158},"sR2V5","const ",[152,161,163],{"class":162},"s5YmX","{\n",[152,165,167,171],{"class":154,"line":166},2,[152,168,170],{"class":169},"s6w83","  user",[152,172,173],{"class":162},",\n",[152,175,177,180],{"class":154,"line":176},3,[152,178,179],{"class":169},"  session",[152,181,173],{"class":162},[152,183,185,188],{"class":154,"line":184},4,[152,186,187],{"class":169},"  loggedIn",[152,189,173],{"class":162},[152,191,193,196],{"class":154,"line":192},5,[152,194,195],{"class":169},"  ready",[152,197,173],{"class":162},[152,199,201,204],{"class":154,"line":200},6,[152,202,203],{"class":169},"  signIn",[152,205,173],{"class":162},[152,207,209,212],{"class":154,"line":208},7,[152,210,211],{"class":169},"  signUp",[152,213,173],{"class":162},[152,215,217,220],{"class":154,"line":216},8,[152,218,219],{"class":169},"  signOut",[152,221,173],{"class":162},[152,223,225,228],{"class":154,"line":224},9,[152,226,227],{"class":169},"  fetchSession",[152,229,173],{"class":162},[152,231,233,236,239,243],{"class":154,"line":232},10,[152,234,235],{"class":162},"}",[152,237,238],{"class":162}," =",[152,240,242],{"class":241},"slgps"," useUserSession",[152,244,245],{"class":162},"()\n",[247,248,250],"h2",{"id":249},"ssr-behavior","SSR behavior",[252,253,254,258,265],"ul",{},[255,256,257],"li",{},"On the server, the module initializes state but does not fetch a session.",[255,259,260,261,264],{},"On the client, a plugin calls ",[138,262,263],{},"fetchSession()"," on first load.",[255,266,267,270,271,274],{},[138,268,269],{},"ready"," flips to ",[138,272,273],{},"true"," after the first fetch attempt.",[135,276,277,278,280,281,284],{},"Use ",[138,279,269],{}," or ",[138,282,283],{},"\u003CBetterAuthState>"," when you need to wait for hydration.",[247,286,288],{"id":287},"see-also","See also",[252,290,291],{},[255,292,293,294],{},"Better Auth session management: ",[295,296,297],"a",{"href":297,"rel":298},"https://www.better-auth.com/docs/concepts/session-management",[299],"nofollow",[301,302,303],"style",{},"html pre.shiki code .sR2V5, html code.shiki .sR2V5{--shiki-light:#AB5959;--shiki-default:#CB7676;--shiki-dark:#CB7676}html pre.shiki code .s5YmX, html code.shiki .s5YmX{--shiki-light:#999999;--shiki-default:#666666;--shiki-dark:#666666}html pre.shiki code .s6w83, html code.shiki .s6w83{--shiki-light:#B07D48;--shiki-default:#BD976A;--shiki-dark:#BD976A}html pre.shiki code .slgps, html code.shiki .slgps{--shiki-light:#59873A;--shiki-default:#80A665;--shiki-dark:#80A665}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);}",{"title":148,"searchDepth":166,"depth":166,"links":305},[306,307],{"id":249,"depth":166,"text":250},{"id":287,"depth":166,"text":288},"SSR‑safe session state via `useUserSession()`.","md",null,{},true,{"title":48,"description":308},"Uj49L0tsRwiVhvqCx8Cw8rXSQuq0Yeuf8C4C17yflXw",[316,318],{"title":44,"path":45,"stem":46,"description":317,"children":-1},"How the server Better Auth instance is created.",{"title":52,"path":53,"stem":54,"description":319,"children":-1},"Protect pages with route rules or meta.",1765664061320]