#Can't access cookie, returning undefined

5 messages · Page 1 of 1 (latest)

cunning breach
#

I am trying to access a cookie but its returning undefined for the value, and cant find the Issue.

My code looks pretty simple so far:

const token = useCookie('token');
console.log('token', token.value)

token undefined, app.vue:4

When looking into dev tools of my browser, the cookie is set and not expired - does anyone has a idea what's the issue here?

oblique lotus
#

Can you provide a reproduction? just tried this in a new project and as soon as the cookie has been set once it shows up in the log as expected

sinful flower
#

can u even access httponly cookies in javascript?

cunning breach
#

Oh wow, thats it......

#

Thanks @sinful flower, was because of the http only, I am a noob in cookies - so I thought it means its to allow the usage on http sites without certs, seems like it isn't Yep