概要:
前の_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))
_get()_の応答ヘッダーでset-cookie
で返されるCookieは、_post()_で必要です。
ただし、post()のヘッダーにはCookieが含まれていないため、失敗します。
どうすれば修正できますか?助けてください。
環境
@varmehこれをどのように修正しましたか?
また好奇心が強い
これは役に立ちますか?
https://stackoverflow.com/questions/46288437/set-cookie-header-has-no-effect
2017年9月25日月曜日22:28、 ChrisGillisnotifications @ github.comは次のように書いています。
また好奇心が強い
—
このスレッドにサブスクライブしているため、これを受け取っています。
このメールに直接返信し、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、 ChrisGillisnotifications @ github.comは次のように書いています。