์์ฝ:
์ด์ _get_ ํธ์ถ์์ ๋ฐ์ ์ฟ ํค๋ ๋ค์ _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
์ ๋ฐํ๋ ์ฟ ํค๋ _post()_์ ํ์ํฉ๋๋ค.
๊ทธ๋ฌ๋ post()๋ ํค๋์ ์ฟ ํค๊ฐ ์์ผ๋ฏ๋ก ์คํจํฉ๋๋ค.
์ด๋ป๊ฒ ๊ณ ์น ์ ์์ต๋๊น? ๋์์ฃผ์ธ์.
ํ๊ฒฝ
@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] ์ด ๋ค์๊ณผ ๊ฐ์ด ์ผ์ต๋๋ค.