© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
3 replies
John Rallis

auth-helpers-sveltekit best way to access session

Hey peeps,

I am making a fresh sveltekit project with supabase for db and auth and just picking up from the documentation example. I noticed 2 ways of accessing the session inside a load function:
const { session} = await getSupabase(event)
const { session} = await getSupabase(event)

and
const session = await getServerSession(event)
const session = await getServerSession(event)

and I was wondering what's the difference between the 2 and whether I should prefer one over the other (e.g. one for server side and one for client side?). Also do I have to load it like that on every route? Can't I just load it on my root's
+layout.server.ts
+layout.server.ts
and pass it down through
data
data
and
const { session } = await parent()
const { session } = await parent()
in my subroute layouts?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Auth-helpers-sveltekit v2 -- supabaseServerClient?
SupabaseSSupabase / help-and-questions
4y ago
Sveltekit auth helpers URLSearchParams empty
SupabaseSSupabase / help-and-questions
4y ago
Using autoRefreshToken with auth-helpers-sveltekit
SupabaseSSupabase / help-and-questions
4y ago
Can't install auth-helpers-sveltekit
SupabaseSSupabase / help-and-questions
4y ago