노드/고속 인증 애플리케이션을 vue.js로 이동하려고합니다. 200 개의 코드를 성공적으로 인증 할 수 있습니다. 그러나 couchdb에서 반환 된 응답에는 필요한 "AuthSession"토큰이 들어있는 "set-cookie"헤더가 포함되어 있지 않습니다. 내 뷰 구성 요소에서 사용하고있는 코드는 다음과 같습니다Couchdb Vue.js 인증
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!')
})
사람이 이제까지 "설정 쿠키"헤더를 받고 문제가 있었나요?
덕분에, 타일러
[AJAX POST 응답에서 쿠키 가져 오기 및 저장] 가능한 복제본] (https://stackoverflow.com/questions/29895569/get-and-store-cookie-from-set-cookie- from-an-ajax-post-response) – Flimzy