[{"data":1,"prerenderedAt":281},["ShallowReactive",2],{"navigation_docs":3,"-core-concepts-server-auth":129,"-core-concepts-server-auth-surround":276},[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":44,"body":131,"description":269,"extension":270,"links":271,"meta":272,"navigation":273,"path":45,"seo":274,"stem":46,"__hash__":275},"docs/2.core-concepts/1.server-auth.md",{"type":132,"value":133,"toc":266},"minimark",[134,142,163,243,246,251,262],[135,136,137,141],"p",{},[138,139,140],"code",{},"serverAuth()"," is auto‑imported on the server. It:",[143,144,145,157,160],"ul",{},[146,147,148,149,152,153,156],"li",{},"Calls your ",[138,150,151],{},"defineServerAuth"," function from ",[138,154,155],{},"server/auth.config.ts",".",[146,158,159],{},"Injects the Drizzle adapter, secret, and baseURL.",[146,161,162],{},"Caches the instance for the lifetime of the server.",[164,165,170],"pre",{"className":166,"code":167,"language":168,"meta":169,"style":169},"language-ts shiki shiki-themes vitesse-light vitesse-dark vitesse-dark","const auth = serverAuth()\nconst session = await auth.api.getSession({ headers: event.headers })\n","ts","",[138,171,172,196],{"__ignoreMap":169},[173,174,177,181,185,189,193],"span",{"class":175,"line":176},"line",1,[173,178,180],{"class":179},"sR2V5","const ",[173,182,184],{"class":183},"s6w83","auth",[173,186,188],{"class":187},"s5YmX"," =",[173,190,192],{"class":191},"slgps"," serverAuth",[173,194,195],{"class":187},"()\n",[173,197,199,201,204,206,210,213,215,218,220,223,226,230,233,236,238,240],{"class":175,"line":198},2,[173,200,180],{"class":179},[173,202,203],{"class":183},"session",[173,205,188],{"class":187},[173,207,209],{"class":208},"sMxC7"," await",[173,211,212],{"class":183}," auth",[173,214,156],{"class":187},[173,216,217],{"class":183},"api",[173,219,156],{"class":187},[173,221,222],{"class":191},"getSession",[173,224,225],{"class":187},"({ ",[173,227,229],{"class":228},"sekRf","headers",[173,231,232],{"class":187},": ",[173,234,235],{"class":183},"event",[173,237,156],{"class":187},[173,239,229],{"class":183},[173,241,242],{"class":187}," })\n",[135,244,245],{},"You rarely need to call it directly unless you’re building custom server logic.",[247,248,250],"h2",{"id":249},"see-also","See also",[143,252,253],{},[146,254,255,256],{},"Better Auth API concepts: ",[257,258,259],"a",{"href":259,"rel":260},"https://www.better-auth.com/docs/concepts/api",[261],"nofollow",[263,264,265],"style",{},"html pre.shiki code .sR2V5, html code.shiki .sR2V5{--shiki-light:#AB5959;--shiki-default:#CB7676;--shiki-dark:#CB7676}html pre.shiki code .s6w83, html code.shiki .s6w83{--shiki-light:#B07D48;--shiki-default:#BD976A;--shiki-dark:#BD976A}html pre.shiki code .s5YmX, html code.shiki .s5YmX{--shiki-light:#999999;--shiki-default:#666666;--shiki-dark:#666666}html pre.shiki code .slgps, html code.shiki .slgps{--shiki-light:#59873A;--shiki-default:#80A665;--shiki-dark:#80A665}html pre.shiki code .sMxC7, html code.shiki .sMxC7{--shiki-light:#1E754F;--shiki-default:#4D9375;--shiki-dark:#4D9375}html pre.shiki code .sekRf, html code.shiki .sekRf{--shiki-light:#998418;--shiki-default:#B8A965;--shiki-dark:#B8A965}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":169,"searchDepth":198,"depth":198,"links":267},[268],{"id":249,"depth":198,"text":250},"How the server Better Auth instance is created.","md",null,{},true,{"title":44,"description":269},"GqOWkdo9oqYZdOErgNsw5RuNdvTH-sUju3E-o69xJIc",[277,279],{"title":40,"path":41,"stem":42,"description":278,"children":-1},"What this module wires up for you.",{"title":48,"path":49,"stem":50,"description":280,"children":-1},"SSR‑safe session state via `useUserSession()`.",1765664060950]