#✅ Problems with refresh cookie and logout

7 messages · Page 1 of 1 (latest)

dusk olive
#

I have had this problem for a while and not really got an answer.
I have a svelte frontend / directus backend. I have updated both the directus sdk and directus to latest versions and upgraded node to 18.14.0.
After login the directus_refresh_token cookie is stored with an appropriate value.

My code is
await directus.auth.logout().
then(() => {
console.log("logout OK - auth token is " + $authToken)
/* do stuff */
})
.catch((error) => {
console.log("Logout error " + error)
});

In the console, I get

Cookie “directus_refresh_token” has been rejected because it is already expired.

logout OK - auth token is eyJhbGciOiJIU......hKTIzHi0aLX4

So why the cookie is rejected (it is seconds old)?
I would just add that previous to today I was getting problems with auth.refresh errors even though I never actually call it. But upgrading directus / the sdk / node may have got rid of that.

worn lionBOT
#

Thanks for posting! This is a community powered server, so you may or may not get an answer based on available help and expertise. To increase your chances of somebody being able to help you, please help us help you making sure you:

  • Adding an explanation of exactly what you're trying to achieve.
  • Adding any and all related code or previous attempts.
  • Describing the exact issue or error you are facing.
  • Posting any screenshots if applicable.
  • Reading through https://stackoverflow.com/help/how-to-ask.

When you're done with this thread, please close it. Thanks! ✨

(If you have a support agreement and need help, please contact the core team via email.)

thorn mortar
#

When do you run directus.auth.login?

worn lionBOT
#

✅ Problems with refresh cookie and logout

worn lionBOT
dusk olive
#

Sorry for the delay in replying.
When the login link is pressed on the menu it calls a modal component that takes email/password and then calls auth.login. If successful, it sets an authenticated variable (along with token - which I never use!) .

dusk olive
#

This is still a problem though have to go through several actions to replicate but leaves several questions.
Even though there is a cookie, why is the cookie expired.