(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7567],{56413:function(i,s,e){(window.__NEXT_P=window.__NEXT_P||[]).push(["/getting-started/adapters/firebase",function(){return e(6847)}])},26829:function(i,s,e){"use strict";e.d(s,{E:function(){return o}});var n=e(651),t=e(80339),r=e(88435),a=e(49004),l=e(61506),h=e(92379);let d="authjs.codeTab.framework";o.Next=E,o.NextClient=x,o.Svelte=u,o.Express=j,o.Qwik=g;let c={[E.name]:"Next.js",[g.name]:"Qwik",[u.name]:"SvelteKit",[j.name]:"Express"},k={[E.name]:"Next.js",[x.name]:"Next.js (Client)",[g.name]:"Qwik",[u.name]:"SvelteKit",[j.name]:"Express"},p=i=>{let s=i.toLowerCase().replaceAll(/[^a-zA-z]+/g,"-");return s.endsWith("-")?s.slice(0,-1):s};function o(i){let{children:s}=i,e=(0,r.useRouter)(),o=(0,t.useSearchParams)(),E=h.Children.toArray(s),{project:u}=(0,a.LU)(),j=E.some(i=>i&&i.type.name===x.name)?k:c,g=i=>{let s=new URLSearchParams(null==o?void 0:o.toString());s.set("framework",i),e.push("".concat(e.pathname,"?").concat(s.toString()))};return(0,h.useEffect)(()=>{let i=Object.keys(j).length,s=window.localStorage.getItem(d),e=parseInt(null!=s?s:"0")%i;s||window.localStorage.setItem(d,"0"),g(p(Object.values(j)[e]))},[e.pathname,j]),(0,n.jsx)("div",{className:"[&_div[role='tablist']]:!pb-0",onClick:i=>{if(!(i.target instanceof HTMLButtonElement))return;let{textContent:s}=i.target;g(p(s))},children:(0,n.jsx)(l.m,{storageKey:d,items:Object.values(j),children:Object.keys(j).map(i=>{var s;let t=E.find(s=>{var e;return(null==s?void 0:null===(e=s.type)||void 0===e?void 0:e.name)===i});return Object.keys(null!==(s=null==t?void 0:t.props)&&void 0!==s?s:{}).length?t:(0,n.jsx)(l.m.Tab,{children:(0,n.jsxs)("p",{className:"rounded-lg bg-slate-100 p-6 font-semibold dark:bg-neutral-950",children:[j[i]," not documented yet. Help us by contributing"," ",(0,n.jsx)("a",{className:"underline",target:"_blank",href:"".concat(u.link,"/edit/main/docs/pages").concat(e.pathname,".mdx"),rel:"noreferrer",children:"here"}),"."]})},i)})})})}function x(i){let{children:s}=i;return(0,n.jsx)(l.m.Tab,{children:s})}function E(i){let{children:s}=i;return(0,n.jsx)(l.m.Tab,{children:s})}function u(i){let{children:s}=i;return(0,n.jsx)(l.m.Tab,{children:s})}function j(i){let{children:s}=i;return(0,n.jsx)(l.m.Tab,{children:s})}function g(i){let{children:s}=i;return(0,n.jsx)(l.m.Tab,{children:s})}},6847:function(i,s,e){"use strict";e.r(s),e.d(s,{useTOC:function(){return k}});var n=e(651),t=e(91260),r=e(14519),a=e(14281),l=e(61506),h=e(78446),d=e(26829),c=e(69866);function k(i){return[{value:"Resources",id:"resources",depth:2},{value:"Setup",id:"setup",depth:2},{value:"Installation",id:"installation",depth:3},{value:"Environment variables",id:"environment-variables",depth:3},{value:"Configuration",id:"configuration",depth:3},{value:"Authentication",id:"authentication",depth:3},{value:"Service Account File",id:"service-account-file",depth:4},{value:"Service Account Values",id:"service-account-values",depth:3},{value:"Using an existing Firestore instance",id:"using-an-existing-firestore-instance",depth:3}]}function p(i,s){throw Error("Expected "+(s?"component":"object")+" `"+i+"` to be defined: you likely forgot to import, pass, or provide it.")}s.default=(0,t.c)(function(i){let{toc:s=k(i)}=i,e={a:"a",blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",li:"li",ol:"ol",p:"p",pre:"pre",span:"span",ul:"ul",...(0,a.a)(),...i.components};return l.m||p("$Tabs",!1),l.m.Tab||p("$Tabs.Tab",!0),d.E||p("Code",!1),d.E.Express||p("Code.Express",!0),d.E.Next||p("Code.Next",!0),d.E.Qwik||p("Code.Qwik",!0),d.E.Svelte||p("Code.Svelte",!0),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("img",{align:"right",src:"/img/adapters/firebase.svg",height:"64",width:"64"}),"\n",(0,n.jsx)(e.h1,{children:"Firebase Adapter"}),"\n",(0,n.jsxs)(e.blockquote,{children:["\n",(0,n.jsxs)(e.p,{children:["Using the ",(0,n.jsx)(e.a,{href:"https://firebase.google.com/docs/admin/setup",children:"Firebase Admin SDK"})," and ",(0,n.jsx)(e.a,{href:"https://firebase.google.com/docs/firestore",children:"Firestore"}),"."]}),"\n"]}),"\n",(0,n.jsx)(e.h2,{id:s[0].id,children:s[0].value}),"\n",(0,n.jsxs)(e.ul,{children:["\n",(0,n.jsx)(e.li,{children:(0,n.jsx)(e.a,{href:"https://firebase.google.com/docs/admin/setup",children:"Firebase Admin documentation"})}),"\n"]}),"\n",(0,n.jsx)(e.h2,{id:s[1].id,children:s[1].value}),"\n",(0,n.jsx)(e.h3,{id:s[2].id,children:s[2].value}),"\n",(0,n.jsxs)(l.m,{items:["npm","pnpm","yarn","bun"],storageKey:"selectedPackageManager",children:[(0,n.jsx)(l.m.Tab,{children:(0,n.jsx)(e.pre,{icon:c.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,n.jsx)(e.code,{children:(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"npm"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" install"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @auth/firebase-adapter"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" firebase-admin"})]})})})}),(0,n.jsx)(l.m.Tab,{children:(0,n.jsx)(e.pre,{icon:c.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,n.jsx)(e.code,{children:(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"pnpm"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" add"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @auth/firebase-adapter"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" firebase-admin"})]})})})}),(0,n.jsx)(l.m.Tab,{children:(0,n.jsx)(e.pre,{icon:c.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,n.jsx)(e.code,{children:(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"yarn"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" add"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @auth/firebase-adapter"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" firebase-admin"})]})})})}),(0,n.jsx)(l.m.Tab,{children:(0,n.jsx)(e.pre,{icon:c.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,n.jsx)(e.code,{children:(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"bun"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" add"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" @auth/firebase-adapter"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" firebase-admin"})]})})})})]}),"\n",(0,n.jsx)(e.h3,{id:s[3].id,children:s[3].value}),"\n",(0,n.jsx)(e.pre,{icon:c.Fx,tabIndex:"0","data-language":"sh","data-word-wrap":"","data-copy":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"//"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" Auth"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" via"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" Service"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" Account"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" File"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"GOOGLE_APPLICATION_CREDENTIALS"})}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"//"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" Auth"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" via"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" key"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" values"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"AUTH_FIREBASE_PROJECT_ID"})}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"AUTH_FIREBASE_CLIENT_EMAIL"})}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"AUTH_FIREBASE_PRIVATE_KEY"})})]})}),"\n",(0,n.jsx)(e.h3,{id:s[4].id,children:s[4].value}),"\n",(0,n.jsxs)(d.E,{children:[(0,n.jsx)(d.E.Next,{children:(0,n.jsx)(e.pre,{icon:c.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"auth.ts","data-copy":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" NextAuth "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "next-auth"'})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { FirestoreAdapter } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/firebase-adapter"'})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"handlers"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"auth"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signIn"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signOut"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" NextAuth"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  providers: [],"})}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  adapter: "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"FirestoreAdapter"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"(),"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"})"})})]})})}),(0,n.jsx)(d.E.Qwik,{children:(0,n.jsx)(e.pre,{icon:c.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"/src/routes/plugin@auth.ts","data-copy":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { QwikAuth$ } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/qwik"'})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { FirestoreAdapter } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/firebase-adapter"'})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"onRequest"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"useSession"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"useSignIn"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"useSignOut"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" QwikAuth$"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  () "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"=>"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" ({"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    providers: [],"})}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    adapter: "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"FirestoreAdapter"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"(),"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  })"})}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:")"})})]})})}),(0,n.jsx)(d.E.Svelte,{children:(0,n.jsx)(e.pre,{icon:c.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"src/auth.ts","data-copy":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { SvelteKitAuth } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/sveltekit"'})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { FirestoreAdapter } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/firebase-adapter"'})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"handle"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signIn"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signOut"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" SvelteKitAuth"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  providers: [],"})}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  adapter: "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"FirestoreAdapter"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"(),"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"})"})})]})})}),(0,n.jsx)(d.E.Express,{children:(0,n.jsx)(e.pre,{icon:c.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"./src/routes/auth.route.ts","data-copy":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { ExpressAuth } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/express"'})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { FirestoreAdapter } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/firebase-adapter"'})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"const"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" app"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" ="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" express"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"()"})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"app."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"set"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:'"trust proxy"'}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"true"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:")"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"app."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"use"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:'  "/auth/*"'}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:","})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"  ExpressAuth"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    providers: [],"})}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    adapter: "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"FirestoreAdapter"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"(),"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  })"})}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:")"})})]})})})]}),"\n",(0,n.jsx)(e.h3,{id:s[5].id,children:s[5].value}),"\n",(0,n.jsx)(e.h4,{id:s[6].id,children:s[6].value}),"\n",(0,n.jsxs)(e.p,{children:["First, create a Firebase project and generate a service account key. Visit: ",(0,n.jsx)(e.code,{children:"https://console.firebase.google.com/u/0/project/{project-id}/settings/serviceaccounts/adminsdk"})," (replace ",(0,n.jsx)(e.code,{children:"{project-id}"})," with your project’s id)"]}),"\n",(0,n.jsxs)(e.ol,{children:["\n",(0,n.jsxs)(e.li,{children:["Download the service account key and save it in your project. (Make sure to add the file to your ",(0,n.jsx)(e.code,{children:".gitignore"}),"!)"]}),"\n",(0,n.jsxs)(e.li,{children:["Add ",(0,n.jsx)(e.a,{href:"https://cloud.google.com/docs/authentication/application-default-credentials#GAC",children:(0,n.jsx)(e.code,{children:"GOOGLE_APPLICATION_CREDENTIALS"})})," to your environment variables and point it to the service account key file."]}),"\n",(0,n.jsx)(e.li,{children:"The adapter will automatically pick up the environment variable and use it to authenticate with the Firebase Admin SDK. You do not need to pass any additional authentication options to the adapter."}),"\n"]}),"\n",(0,n.jsx)(e.h3,{id:s[7].id,children:s[7].value}),"\n",(0,n.jsxs)(e.ol,{children:["\n",(0,n.jsx)(e.li,{children:"Download the service account key to a temporary location (Don’t commit this file!)."}),"\n",(0,n.jsxs)(e.li,{children:["Add the following environment variables to your project",(0,n.jsx)(e.br,{}),"\n","a. ",(0,n.jsx)(e.code,{children:"AUTH_FIREBASE_PROJECT_ID"}),(0,n.jsx)(e.br,{}),"\n","b. ",(0,n.jsx)(e.code,{children:"AUTH_FIREBASE_CLIENT_EMAIL"}),(0,n.jsx)(e.br,{}),"\n","c. ",(0,n.jsx)(e.code,{children:"AUTH_FIREBASE_PRIVATE_KEY"})]}),"\n"]}),"\n",(0,n.jsx)(e.pre,{icon:c.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"./auth.ts","data-copy":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" NextAuth "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "next-auth"'})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { FirestoreAdapter } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/firebase-adapter"'})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { cert } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "firebase-admin/app"'})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"handlers"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"auth"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signIn"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signOut"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" NextAuth"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  adapter: "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"FirestoreAdapter"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    credential: "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"cert"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"      projectId: process.env."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"AUTH_FIREBASE_PROJECT_ID"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:","})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"      clientEmail: process.env."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"AUTH_FIREBASE_CLIENT_EMAIL"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:","})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"      privateKey: process.env."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"AUTH_FIREBASE_PRIVATE_KEY"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:","})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    }),"})}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  }),"})}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"})"})})]})}),"\n",(0,n.jsx)(e.h3,{id:s[8].id,children:s[8].value}),"\n",(0,n.jsx)(e.p,{children:"If you already have a Firestore instance, you can pass that to the adapter directly instead."}),"\n",(0,n.jsx)(h.U,{children:(0,n.jsx)(e.p,{children:"When passing an instance and in a serverless environment, remember to handle\nduplicate app initialization."})}),"\n",(0,n.jsx)(h.U,{type:"info",children:(0,n.jsxs)(e.p,{children:["You can use the ",(0,n.jsx)(e.code,{children:"initFirestore"})," utility to initialize the app and get an\ninstance safely."]})}),"\n",(0,n.jsx)(e.pre,{icon:c.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"./auth.ts","data-copy":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" NextAuth "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "next-auth"'})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { FirestoreAdapter } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/firebase-adapter"'})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { firestore } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "lib/firestore"'})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"handlers"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"auth"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signIn"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"signOut"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" NextAuth"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  adapter: "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"FirestoreAdapter"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"(firestore),"})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"})"})})]})}),"\n",(0,n.jsxs)(e.p,{children:["Utility function that helps making sure that there is no duplicate app initialization issues in serverless environments.\nIf no parameter is passed, it will use the ",(0,n.jsx)(e.code,{children:"GOOGLE_APPLICATION_CREDENTIALS"})," environment variable to initialize a Firestore instance."]}),"\n",(0,n.jsx)(e.pre,{icon:c.KP,tabIndex:"0","data-language":"ts","data-word-wrap":"","data-filename":"lib/firestore.ts","data-copy":"",children:(0,n.jsxs)(e.code,{children:[(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { initFirestore } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "@auth/firebase-adapter"'})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:" { cert } "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"from"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "firebase-admin/app"'})]}),"\n",(0,n.jsx)(e.span,{children:" "}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"export"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" const"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" firestore"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" ="}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" initFirestore"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  credential: "}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"cert"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"({"})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    projectId: process.env."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"FIREBASE_PROJECT_ID"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:","})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    clientEmail: process.env."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"FIREBASE_CLIENT_EMAIL"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:","})]}),"\n",(0,n.jsxs)(e.span,{children:[(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"    privateKey: process.env."}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"FIREBASE_PRIVATE_KEY"}),(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:","})]}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"  }),"})}),"\n",(0,n.jsx)(e.span,{children:(0,n.jsx)(e.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"})"})})]})})]})},"/getting-started/adapters/firebase",{filePath:"pages/getting-started/adapters/firebase.mdx",timestamp:173646501e4,pageMap:r.v,frontMatter:{},title:"Firebase Adapter"},"undefined"==typeof RemoteContent?k:RemoteContent.useTOC)},78446:function(i,s,e){"use strict";e.d(s,{U:function(){return h}});var n=e(651),t=e(69577),r=e(69866);let a={default:"\uD83D\uDCA1",error:"\uD83D\uDEAB",info:(0,n.jsx)(r.AV,{className:"_mt-1"}),warning:"⚠️"},l={default:(0,t.Z)("_border-orange-100 _bg-orange-50 _text-orange-800 dark:_border-orange-400/30 dark:_bg-orange-400/20 dark:_text-orange-300"),error:(0,t.Z)("_border-red-200 _bg-red-100 _text-red-900 dark:_border-red-200/30 dark:_bg-red-900/30 dark:_text-red-200"),info:(0,t.Z)("_border-blue-200 _bg-blue-100 _text-blue-900 dark:_border-blue-200/30 dark:_bg-blue-900/30 dark:_text-blue-200"),warning:(0,t.Z)("_border-yellow-100 _bg-yellow-50 _text-yellow-900 dark:_border-yellow-200/30 dark:_bg-yellow-700/30 dark:_text-yellow-200")};function h({children:i,type:s="default",emoji:e=a[s]}){return(0,n.jsxs)("div",{className:(0,t.Z)("nextra-callout _overflow-x-auto _mt-6 _flex _rounded-lg _border _py-2 ltr:_pr-4 rtl:_pl-4","contrast-more:_border-current contrast-more:dark:_border-current",l[s]),children:[(0,n.jsx)("div",{className:"_select-none _text-xl ltr:_pl-3 ltr:_pr-2 rtl:_pr-3 rtl:_pl-2",style:{fontFamily:'"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'},children:e}),(0,n.jsx)("div",{className:"_w-full _min-w-0 _leading-7",children:i})]})}},61506:function(i,s,e){"use strict";let n,t,r;e.d(s,{m:function(){return q}});var a=e(651),l=e(24667),h=e(89448),d=e(92379),c=e(68245),k=e(93721),p=e(64290),o=e(97616),x=e(53664),E=e(52466),u=e(88279);function j({onFocus:i}){let s;let[e,n]=(0,d.useState)(!0),t=(s=(0,d.useRef)(!1),(0,p.e)(()=>(s.current=!0,()=>{s.current=!1}),[]),s);return e?d.createElement(u._,{as:"button",type:"button",features:u.x.Focusable,onFocus:s=>{s.preventDefault();let e,r=50;e=requestAnimationFrame(function s(){if(r--<=0){e&&cancelAnimationFrame(e);return}if(i()){if(cancelAnimationFrame(e),!t.current)return;n(!1);return}e=requestAnimationFrame(s)})}}):null}var g=e(92717),y=e(46289),F=e(72613),b=e(38483),f=e(24933);let m=d.createContext(null);function C({children:i}){let s=d.useRef({groups:new Map,get(i,s){var e;let n=this.groups.get(i);n||(n=new Map,this.groups.set(i,n));let t=null!=(e=n.get(s))?e:0;return n.set(s,t+1),[Array.from(n.keys()).indexOf(s),function(){let i=n.get(s);i>1?n.set(s,i-1):n.delete(s)}]}});return d.createElement(m.Provider,{value:s},i)}function A(i){let s=d.useContext(m);if(!s)throw Error("You must wrap your component in a <StableCollection>");let e=d.useId(),[n,t]=s.current.get(i,e);return d.useEffect(()=>t,[]),n}var v=e(88363),_=((n=_||{})[n.Forwards=0]="Forwards",n[n.Backwards=1]="Backwards",n),B=((t=B||{})[t.Less=-1]="Less",t[t.Equal=0]="Equal",t[t.Greater=1]="Greater",t),I=((r=I||{})[r.SetSelectedIndex=0]="SetSelectedIndex",r[r.RegisterTab=1]="RegisterTab",r[r.UnregisterTab=2]="UnregisterTab",r[r.RegisterPanel=3]="RegisterPanel",r[r.UnregisterPanel=4]="UnregisterPanel",r);let w={0(i,s){var e;let n=(0,g.z2)(i.tabs,i=>i.current),t=(0,g.z2)(i.panels,i=>i.current),r=n.filter(i=>{var s;return!(null!=(s=i.current)&&s.hasAttribute("disabled"))}),a={...i,tabs:n,panels:t};if(s.index<0||s.index>n.length-1){let e=(0,y.E)(Math.sign(s.index-i.selectedIndex),{[-1]:()=>1,0:()=>(0,y.E)(Math.sign(s.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(0===r.length)return a;let t=(0,y.E)(e,{0:()=>n.indexOf(r[0]),1:()=>n.indexOf(r[r.length-1])});return{...a,selectedIndex:-1===t?i.selectedIndex:t}}let l=n.slice(0,s.index),h=[...n.slice(s.index),...l].find(i=>r.includes(i));if(!h)return a;let d=null!=(e=n.indexOf(h))?e:i.selectedIndex;return -1===d&&(d=i.selectedIndex),{...a,selectedIndex:d}},1(i,s){if(i.tabs.includes(s.tab))return i;let e=i.tabs[i.selectedIndex],n=(0,g.z2)([...i.tabs,s.tab],i=>i.current),t=i.selectedIndex;return i.info.current.isControlled||-1===(t=n.indexOf(e))&&(t=i.selectedIndex),{...i,tabs:n,selectedIndex:t}},2:(i,s)=>({...i,tabs:i.tabs.filter(i=>i!==s.tab)}),3:(i,s)=>i.panels.includes(s.panel)?i:{...i,panels:(0,g.z2)([...i.panels,s.panel],i=>i.current)},4:(i,s)=>({...i,panels:i.panels.filter(i=>i!==s.panel)})},T=(0,d.createContext)(null);function D(i){let s=(0,d.useContext)(T);if(null===s){let s=Error(`<${i} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,D),s}return s}T.displayName="TabsDataContext";let P=(0,d.createContext)(null);function S(i){let s=(0,d.useContext)(P);if(null===s){let s=Error(`<${i} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,S),s}return s}function R(i,s){return(0,y.E)(s.type,w,i,s)}P.displayName="TabsActionsContext";let N=f.VN.RenderStrategy|f.VN.Static,O=(0,f.yV)(function(i,s){var e,n;let t=(0,d.useId)(),{id:r=`headlessui-tabs-tab-${t}`,disabled:a=!1,autoFocus:o=!1,...u}=i,{orientation:j,activation:m,selectedIndex:C,tabs:_,panels:B}=D("Tab"),I=S("Tab"),w=D("Tab"),[T,P]=(0,d.useState)(null),R=(0,d.useRef)(null),N=(0,E.T)(R,s,P);(0,p.e)(()=>I.registerTab(R),[I,R]);let O=A("tabs"),L=_.indexOf(R);-1===L&&(L=O);let U=L===C,K=(0,k.z)(i=>{var s;let e=i();if(e===g.fE.Success&&"auto"===m){let i=null==(s=(0,b.r)(R))?void 0:s.activeElement,e=w.tabs.findIndex(s=>s.current===i);-1!==e&&I.change(e)}return e}),M=(0,k.z)(i=>{let s=_.map(i=>i.current).filter(Boolean);if(i.key===v.R.Space||i.key===v.R.Enter){i.preventDefault(),i.stopPropagation(),I.change(L);return}switch(i.key){case v.R.Home:case v.R.PageUp:return i.preventDefault(),i.stopPropagation(),K(()=>(0,g.jA)(s,g.TO.First));case v.R.End:case v.R.PageDown:return i.preventDefault(),i.stopPropagation(),K(()=>(0,g.jA)(s,g.TO.Last))}if(K(()=>(0,y.E)(j,{vertical:()=>i.key===v.R.ArrowUp?(0,g.jA)(s,g.TO.Previous|g.TO.WrapAround):i.key===v.R.ArrowDown?(0,g.jA)(s,g.TO.Next|g.TO.WrapAround):g.fE.Error,horizontal:()=>i.key===v.R.ArrowLeft?(0,g.jA)(s,g.TO.Previous|g.TO.WrapAround):i.key===v.R.ArrowRight?(0,g.jA)(s,g.TO.Next|g.TO.WrapAround):g.fE.Error}))===g.fE.Success)return i.preventDefault()}),z=(0,d.useRef)(!1),V=(0,k.z)(()=>{var i;z.current||(z.current=!0,null==(i=R.current)||i.focus({preventScroll:!0}),I.change(L),(0,F.Y)(()=>{z.current=!1}))}),G=(0,k.z)(i=>{i.preventDefault()}),{isFocusVisible:H,focusProps:q}=(0,l.F)({autoFocus:o}),{isHovered:Q,hoverProps:Y}=(0,h.X)({isDisabled:a}),{pressed:Z,pressProps:$}=(0,c.x)({disabled:a}),W=(0,d.useMemo)(()=>({selected:U,hover:Q,active:Z,focus:H,autofocus:o,disabled:a}),[U,Q,H,Z,o,a]),J=(0,f.dG)({ref:N,onKeyDown:M,onMouseDown:G,onClick:V,id:r,role:"tab",type:(0,x.f)(i,T),"aria-controls":null==(n=null==(e=B[L])?void 0:e.current)?void 0:n.id,"aria-selected":U,tabIndex:U?0:-1,disabled:a||void 0,autoFocus:o},q,Y,$);return(0,f.L6)()({ourProps:J,theirProps:u,slot:W,defaultTag:"button",name:"Tabs.Tab"})}),L=(0,f.yV)(function(i,s){let{defaultIndex:e=0,vertical:n=!1,manual:t=!1,onChange:r,selectedIndex:a=null,...l}=i,h=n?"vertical":"horizontal",c=t?"manual":"auto",x=null!==a,u=(0,o.E)({isControlled:x}),y=(0,E.T)(s),[F,b]=(0,d.useReducer)(R,{info:u,selectedIndex:null!=a?a:e,tabs:[],panels:[]}),m=(0,d.useMemo)(()=>({selectedIndex:F.selectedIndex}),[F.selectedIndex]),A=(0,o.E)(r||(()=>{})),v=(0,o.E)(F.tabs),_=(0,d.useMemo)(()=>({orientation:h,activation:c,...F}),[h,c,F]),B=(0,k.z)(i=>(b({type:1,tab:i}),()=>b({type:2,tab:i}))),I=(0,k.z)(i=>(b({type:3,panel:i}),()=>b({type:4,panel:i}))),w=(0,k.z)(i=>{D.current!==i&&A.current(i),x||b({type:0,index:i})}),D=(0,o.E)(x?i.selectedIndex:F.selectedIndex),S=(0,d.useMemo)(()=>({registerTab:B,registerPanel:I,change:w}),[]);(0,p.e)(()=>{b({type:0,index:null!=a?a:e})},[a]),(0,p.e)(()=>{if(void 0===D.current||F.tabs.length<=0)return;let i=(0,g.z2)(F.tabs,i=>i.current);i.some((i,s)=>F.tabs[s]!==i)&&w(i.indexOf(F.tabs[D.current]))});let N=(0,f.L6)();return d.createElement(C,null,d.createElement(P.Provider,{value:S},d.createElement(T.Provider,{value:_},_.tabs.length<=0&&d.createElement(j,{onFocus:()=>{var i,s;for(let e of v.current)if((null==(i=e.current)?void 0:i.tabIndex)===0)return null==(s=e.current)||s.focus(),!0;return!1}}),N({ourProps:{ref:y},theirProps:l,slot:m,defaultTag:"div",name:"Tabs"}))))}),U=(0,f.yV)(function(i,s){let{orientation:e,selectedIndex:n}=D("Tab.List"),t=(0,E.T)(s),r=(0,d.useMemo)(()=>({selectedIndex:n}),[n]);return(0,f.L6)()({ourProps:{ref:t,role:"tablist","aria-orientation":e},theirProps:i,slot:r,defaultTag:"div",name:"Tabs.List"})}),K=(0,f.yV)(function(i,s){let{selectedIndex:e}=D("Tab.Panels"),n=(0,E.T)(s),t=(0,d.useMemo)(()=>({selectedIndex:e}),[e]);return(0,f.L6)()({ourProps:{ref:n},theirProps:i,slot:t,defaultTag:"div",name:"Tabs.Panels"})}),M=(0,f.yV)(function(i,s){var e,n,t,r;let a=(0,d.useId)(),{id:h=`headlessui-tabs-panel-${a}`,tabIndex:c=0,...k}=i,{selectedIndex:o,tabs:x,panels:j}=D("Tab.Panel"),g=S("Tab.Panel"),y=(0,d.useRef)(null),F=(0,E.T)(y,s);(0,p.e)(()=>g.registerPanel(y),[g,y]);let b=A("panels"),m=j.indexOf(y);-1===m&&(m=b);let C=m===o,{isFocusVisible:v,focusProps:_}=(0,l.F)(),B=(0,d.useMemo)(()=>({selected:C,focus:v}),[C,v]),I=(0,f.dG)({ref:F,id:h,role:"tabpanel","aria-labelledby":null==(n=null==(e=x[m])?void 0:e.current)?void 0:n.id,tabIndex:C?c:-1},_),w=(0,f.L6)();return C||null!=(t=k.unmount)&&!t||null!=(r=k.static)&&r?w({ourProps:I,theirProps:k,slot:B,defaultTag:"div",features:N,visible:C,name:"Tabs.Panel"}):d.createElement(u._,{"aria-hidden":"true",...I})}),z=Object.assign(O,{Group:L,List:U,Panels:K,Panel:M});var V=e(69577);function G(i){return!!i&&"object"==typeof i&&"label"in i}function H({items:i,selectedIndex:s,defaultIndex:e=0,onChange:n,children:t,storageKey:r}){let[l,h]=(0,d.useState)(e);(0,d.useEffect)(()=>{void 0!==s&&h(s)},[s]),(0,d.useEffect)(()=>{if(!r)return;function i(i){i.key===r&&h(Number(i.newValue))}let s=Number(localStorage.getItem(r));return h(Number.isNaN(s)?0:s),window.addEventListener("storage",i),()=>{window.removeEventListener("storage",i)}},[]);let c=(0,d.useCallback)(i=>{if(r){let s=String(i);localStorage.setItem(r,s),window.dispatchEvent(new StorageEvent("storage",{key:r,newValue:s}));return}h(i),n?.(i)},[]);return(0,a.jsxs)(L,{selectedIndex:l,defaultIndex:e,onChange:c,tabIndex:-1,children:[(0,a.jsx)(U,{className:(0,V.Z)("nextra-scrollbar _overflow-x-auto _overscroll-x-contain _overflow-y-hidden","_mt-4 _flex _w-full _gap-2 _border-b _border-gray-200 _pb-px dark:_border-neutral-800","nextra-focus"),children:i.map((i,s)=>(0,a.jsx)(z,{disabled:G(i)&&i.disabled,className:({selected:i,disabled:s,hover:e,focus:n})=>(0,V.Z)(n&&"nextra-focusable _ring-inset",i&&"_outline-none","_whitespace-nowrap","_rounded-t _p-2 _font-medium _leading-5 _transition-colors","_-mb-0.5 _select-none _border-b-2",i?"_border-current":e?"_border-gray-200 dark:_border-neutral-800":"_border-transparent",i?"_text-primary-600":s?"_text-gray-400 dark:_text-neutral-600 _pointer-events-none":e?"_text-black dark:_text-white":"_text-gray-600 dark:_text-gray-200"),children:G(i)?i.label:i},s))}),(0,a.jsx)(K,{children:t})]})}let q=Object.assign(i=>(0,a.jsx)(H,{...i}),{Tab:function({children:i,unmount:s=!1,...e}){return(0,a.jsx)(M,{...e,unmount:s,className:({focus:i})=>(0,V.Z)("_rounded _mt-6",i&&"nextra-focusable"),children:i})}})}},function(i){i.O(0,[91260,14519,92888,49774,40179],function(){return i(i.s=56413)}),_N_E=i.O()}]);