我的 HttpOnly cookie 有问题,我有一个自定义身份验证 API,它在我登录时返回一个带有令牌的 HttpOnly cookie,但问题是,当我使用 withCredentials 在 Axios 前面发出另一个请求时,cookie 是不发送标题,我不明白为什么。
我使用 NextJs 作为前端,使用 Strapi 作为后端
这是创建第二个请求的代码
await axios.get(param.endpoints.getMe, {withCredentials: true})
答案 0 :(得分:0)
解决方案
问题是我忘记在登录请求中添加“withCredentials: true”。
我在这上面花了 4 个小时。
我讨厌自己