【发布时间】:2018-05-06 17:38:38
【问题描述】:
我正在尝试将 node/express 身份验证应用程序移至 vue.js。我能够成功验证获得 200 代码。但是,从 couchdb 返回的响应不包含“set-cookie”标头,其中包含急需的 AuthSession 令牌。我在 Vue 组件中使用的代码是:
var reqBody = "name="+user+"&password="+pass;
var reqBodyLength = reqBody.length;
console.log(reqBodyLength);
this.$http.post('http://localhost:5984/_session/', reqBody, {headers: {'Content-Type' : 'application/x-www-form-urlencoded', 'Accept' : 'application/json'}}).then(response => {
console.log("response: " + JSON.stringify(response));
console.log("response.headers: " + JSON.stringify(response.headers));
console.log("response.headers.set-cookie: " + JSON.stringify(response.headers["set-cookie"]));
}, response => {
alert('you unauthorized, fool!')
})
有人在获取“set-cookie”标头时遇到过问题吗?
谢谢,泰勒
【问题讨论】:
标签: authentication vuejs2 couchdb token