Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session has been removed from $app/stores #35

Open
yoh-extradat opened this issue Nov 23, 2022 · 2 comments
Open

session has been removed from $app/stores #35

yoh-extradat opened this issue Nov 23, 2022 · 2 comments

Comments

@yoh-extradat
Copy link

Trying to solve the same problem and came across your project. However i am struggling to implement it, because session has been removed from $app/stores.
Any idea how to fix it?

@msturge
Copy link

msturge commented Feb 28, 2024

I have the same issue. trying to refactor this code to work properly now that $app/stores no longer contains sessions.

@jmagrippis
Copy link
Owner

Oh, hi @msturge & @yoh-extradat 😅 Sorry that I haven't seen this for years!

I think the most similar, "modern SvelteKit", thing I've done since is for this livestream: https://www.youtube.com/watch?v=SWYqPpbdOfg

I've done quite a few streams on setting auth up with Supabase, and some with Auth.js, but none with Firebase since this one, sorry!

The general idea I like at the moment, no matter your specific auth solution, is to use your hook.server.ts to put a getSession in the locals.

Then you can have a load method ((maybe even the load method in your root +layout.server.ts) return it (like return { session: getSession}, or even return { session: await getSession() if you don't want to stream it), and then any component that needs it will find it at $page.data.session.

Let me know if you're still looking for better solutions, or if you've found a different good one in the meantime (hopefully 😅)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants