session

#14 · closed · 2 comments

View on GitHub ↗

dongumayagay

Sveltekit has a built-in Session store. any thoughts on using that?

Comments

CaptainCodeman

Yes, you can use that with SvelteKit but IMO it only makes sense if you need to support SSR or want to use auth with SK endpoints (i.e. you're getting data other than directly from Firebase services). To use it you'd hook into `onAuthStateChanged` on the client and use that the create or delete a session with fetch POST / DELETE requests to an endpoint that uses firebase-admin `createSessionCookie` to create the cookie, and corresponding `verifySessionCookie` in hooks / getSession. The client can also update the session it already has to remove the need for a page request to have them in sync.

dongumayagay

I see, Thanks for clarifying i will use this your example for my app then. btw are you still planning to do what you said in your roadmap? maybe in the future i'll try also try to authenticate using firebase admin.