#Set Session Cookies in Astro

1 messages · Page 1 of 1 (latest)

vestal pendant
#

Is the API call made server side or client side?

#

(sorry I don't know much about Astro)

onyx mango
#

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?

vestal pendant
onyx mango
#

Well we need to set something, even for email/pass.

vestal pendant
onyx mango
#

The Astro demo provided by Appwrite does use SSR.

vestal pendant
#

You would need to:

  1. Proxy the authentication through your server side Astro
  2. Manually authenticate so you can grab the session cookie.
  3. Pass it to your front end so that your front end and back end can use the cookie automatically
vestal pendant
vestal pendant
onyx mango
#

Obviously not.

vestal pendant
onyx mango
#

I want it to keep the user logged in, in some way.

onyx mango
#

(Unsolved) Set Session Cookies in Astro

vestal pendant