Cookies 如何在react native上发送以下post()中的axios get()中接收到的cookie?
摘要: 在前一个get调用中接收到的Cookie未使用以下post命令发送 详细信息: 我使用以下调用序列登录到后端Cookies 如何在react native上发送以下post()中的axios get()中接收到的cookie?,cookies,react-native,axios,Cookies,React Native,Axios,摘要: 在前一个get调用中接收到的Cookie未使用以下post命令发送 详细信息: 我使用以下调用序列登录到后端 axios.get(Url.csrfToken(), { withCredentials: true }) .then(response => response.data) .then(token => axios.post(Url.authenticate(), { username, password }, {
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()的头中没有任何cookie,导致失败
我怎样才能修好它,请帮忙
环境
- 反应:16.0.0-alpha.12
- 反应本机:0.47.2
- iOS模拟器-版本10.0