Looking for a pattern to handle Firebase Auth (client-side auth) #6304
Replies: 5 comments 2 replies
-
I'm using supabase oauth. Not sure how much it parallels to firebase, but I'm using the |
Beta Was this translation helpful? Give feedback.
-
I use Firebase auth on all SK projects. upon client side login, post In that endpoint, I verify the token, then create a Then in |
Beta Was this translation helpful? Give feedback.
-
If Supabase example may be relevant here is my repo using hooks.js and getSession to populate event.locals with user and accessToken. |
Beta Was this translation helpful? Give feedback.
-
As @acoyfellow has said, but also, you can use firebase-admin after being authenticated if you need to use firestore for example for SSR. This is a good example, although, it doesn't apply the latest Sveltekit changes: |
Beta Was this translation helpful? Give feedback.
-
Not completely related to Firebase but this is helping think how to refactor Session: https://www.loopwerk.io/articles/2022/sveltekit-session-refactor/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi together,
as there were a lot of changes in the last few weeks (and my Sveltekit version was quite outdated 😅) I am going under a big refactor of my codebase. While rewriting some parts I realised that I do not like the way I handle the firebase auth and the auth store in my project. Therefore I am looking for a pattern that helps me handle it better.
My problem is that the firebase auth is handled client-side - when a user logs in, I save the user's information in a store. That works great for the client side - but if I want to load some data via
+page.server.ts
I do not have access to the user id there (and I get that, that makes a lot of sense). Prior I was thinking of saving the user id and some information in asession
- but nowsession
is removed.What would you suggest? How do you handle it in your project when you are using a client-side auth library?
Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions