PouchDB同步不向CouchDB发送凭据

时间:2017-10-16 06:34:32

标签: couchdb pouchdb

我有一个安全的CouchDB实例正在运行。对于复制,我按照“入门”指南中的说明进行操作。但是,PouchDB似乎并没有将我的凭据发送到服务器,因此我从CouchDB收到“需要身份验证”错误。

重现

this.db = new PouchDB('nfcs');    
this.remote = 'https://USER:PASSWORD@couchdb.pixelarbeit.de/nfcs';

let options = {
    live: true,
    retry: true,
    continuous: true
};

this.db.sync(this.remote, options)
    .on('error', err => console.log('PouchDB Error NFCs', err))
    .on('active', err => console.log('PouchDB Active', err))
    .on('complete', err => console.log('PouchDB Complete', err));

发送到服务器的标头

Request URL:https://couchdb.pixelarbeit.de/nfcs/
Request Method:OPTIONS
Status Code:401 Unauthorized
Remote Address:185.26.156.40:443
Referrer Policy:no-referrer-when-downgrade
Response Headers

Access-Control-Allow-Origin:http://localhost:8100
Access-Control-Expose-Headers:Cache-Control, Content-Type, Server
Cache-Control:must-revalidate
Connection:close
Content-Length:61
Content-Type:text/plain; charset=utf-8
Date:Mon, 16 Oct 2017 06:12:45 GMT
Server:CouchDB/1.6.1 (Erlang OTP/17)
WWW-Authenticate:Basic realm="server"
Request Headers

Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4,ru;q=0.2,es;q=0.2
Access-Control-Request-Headers:authorization
Access-Control-Request-Method:GET
Cache-Control:no-cache
Connection:keep-alive
Host:couchdb.pixelarbeit.de
Origin:http://localhost:8100
Pragma:no-cache
Referer:http://localhost:8100/
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

1 个答案:

答案 0 :(得分:-1)

我刚刚解决了这个问题。似乎PouchDB插件破坏了功能。