概括:
在之前的 _get_ 调用中收到的 Cookie 不会使用以下 _post_ 命令发送。
细节:
我正在使用以下调用序列登录后端。
axios.get(Url.csrfToken(), { withCredentials: true })
.then(response => response.data)
.then(token => axios.post(Url.authenticate(), { username, password }, {
headers: {
'content-type' : 'application/x-www-form-urlencoded',
'crsf-token' : `${token.csrfToken}`
},
withCredentials: true
})
)
.then(response => console.log('completed'))
.catch(error => console.log(error))
_post()_ 需要在 _get()_ 的响应标头中以set-cookie
返回的 Cookie。
但是 post() 在其 header 中没有任何 cookie ,导致失败。
我该如何解决它,请帮忙?
环境
@varmeh你是怎么解决这个问题的?
也很好奇
这有帮助吗?
https://stackoverflow.com/questions/46288437/set-cookie-header-has-no-effect
2017 年 9 月 25 日星期一 22:28,Chris Gillis [email protected]写道:
也很好奇
—
您收到此消息是因为您订阅了此线程。
直接回复此邮件,在 GitHub 上查看
https://github.com/mzabriskie/axios/issues/1076#issuecomment-332002134 ,
或使线程静音
https://github.com/notifications/unsubscribe-auth/AVepSmu6HPCE7R-bdBHXU4wa12co56ekks5smAzWgaJpZM4PPYy9
.
最有用的评论
这有帮助吗?
https://stackoverflow.com/questions/46288437/set-cookie-header-has-no-effect
2017 年 9 月 25 日星期一 22:28,Chris Gillis [email protected]写道: