Back

Cookies disappears after login

  • 0
  • Self Hosted
  • Web
  • Cloud
Sam K
3 Feb, 2024, 19:52

Hello, I am developing a Nuxt application locally with the Web SDK. After loggin in I can see the cookies disappear when i refresh the page the middleware kicks me out from the protected routes 😂

As there's no domain for the app, I can't use Appwrite Cloud domains here's what I tried:

1 - I moved the stuff to my home server and tunnel it with Cloudflare tunnels. so the url looks like this https://subdomain.example.com

2 - Edit my computer (osx) hosts file so Nuxt can use the same domain so the url looks like this http://example.com:5002

3 - Modified the selfhosted instance of appwrite apps to accept connections from example.com

4 - I disabled Chrome's securitry

Still the same behaviour :/ any guidance on what to do next??

Thanks 🙂

TL;DR
Title: Cookies disappear after login in Nuxt application with Web SDK - The issue is that cookies disappear after login and the middleware kicks users out from protected routes when the page is refreshed. - The cookies are tied to the domain, not the app. - To fix the issue, check the cookies in the Appwrite instance and make sure the browser has the cookie. - If using SSR, the backend may not have the user's cookie/session. Steps tried: 1. Moved the application to a home server and used Cloudflare tunnels to tunnel the URL. 2. Edited the computer's hosts file (OSX) to use the same
Steven
3 Feb, 2024, 19:54

Cookies are tied to the domain, not your app. Go to your appwrite instance and look at the cookies. You'll see the browser does have the cookie.

If you're using SSR, most likely, your back end doesn't have the users cookie/session

Sam K
3 Feb, 2024, 19:56

Thank you @Steven I know the cookies are tied to the domain, that;s why I modified my hosts file, when I access Nuxt has the same domian as my slefhosted instance.

Sam K
3 Feb, 2024, 19:57
Sam K
3 Feb, 2024, 19:58

And I am using web SKD the login and middleware are client. I will try to change the to SPA mode and see what happens

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more