简体   繁体   English

如何在 nodejs http 中设置和获取 cookie 使用 jwt 没有快递?

[英]how to set and get the cookie in nodejs http use jwt without express?

when I set the cookie in this way: res.writeHead(200, { 'Set-Cookie': access-token=${token} , }) how can I get the cookie in another request?当我以这种方式设置 cookie 时: res.writeHead(200, { 'Set-Cookie': access-token=${token} , }) 如何在另一个请求中获取 cookie?

If the cookie was set, then you should be able to get the cookie in the request header.如果设置了 cookie,那么您应该能够在请求 header 中获取 cookie。

console.log(request.cookies);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM