Can't get individual cookies of client. Cookies are setted globally
[issue link]I handled authentication with cookies in Nuxt, the code is as bellow:
nuxtServerInit ({ commit, state }, { req }) {
console.log('nuxtServerInit')
if (req.headers.cookie) {
let cookieParsed = cookieparser.parse(req.headers.cookie)
// console.log(cookieParsed)
if (cookieParsed.token !== undefined && cookieParsed.userId !== undefined) {
// console.log('parsed.token', cookieParsed)
let token = null
token = cookieParsed.token
state.userId = cookieParsed.userId
commit('auth/setToken', token)
}
}
},
But, while I test and I login I could access succesfully to my account. But if I try in another Pc or in a new incognito window in Chrome I could access to the same account that I did before. How is it possible? It seems cookies are stored globally. But in the code I get cookies from req (the client request). Please let me know what I missed out.