#Set Session Cookies in Astro
1 messages · Page 1 of 1 (latest)
SSR, which should work.
We need to add a cookies.set function, but I don't know what data to apply.
In signin.ts, we can do like:
cookies.set("user-token", VARIABLE_HERE, {
sameSite: "strict",
path: "/",
secure: true,
})
Hmm, I could maybe grab the providerAccessToken and providerRefreshToken somehow and set those?
Those are from an oauth provider
Well we need to set something, even for email/pass.
The web sdk doesn't work well with SSR because the session is persisted in local storage or cookies...which don't work server side
The Astro demo provided by Appwrite does use SSR.
You would need to:
- Proxy the authentication through your server side Astro
- Manually authenticate so you can grab the session cookie.
- Pass it to your front end so that your front end and back end can use the cookie automatically
Which?
And you're doing the exact same thing as this demo?
Obviously not.
So why are you bringing it up?
I want it to keep the user logged in, in some way.
(Unsolved) Set Session Cookies in Astro
Then you'll have to follow what's done in the example you linked...