Replies: 1 comment 4 replies
-
The session cookie is a frontend API concept, but there is actually a REST API endpoint to retrieve the session object that you could call from the server-side.
Along with these HTTP headers (javascript):
That will return a decoded session object that looks something like this:
There's a background discussion on how to improve and thereafter document the frontend API endpoints, but we're unlikely to get it done this year. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wonder if there is any way to get the current logged user from the cookies.
This could prove really useful when building custom storefronts (such as marketplaces) and you want to performed admin level actions.
Maybe this can already be done and I was not able to find it.
A way to get the logged user or a way to create a new client with an specific user would be really cool. For example Supabase has something similar: https://supabase.com/docs/guides/auth/auth-helpers/nextjs. But in the case of Swell it could be simpler, just a
getUserFromCookie
in the Backend API could do the trick.Beta Was this translation helpful? Give feedback.
All reactions