pubkey / rxdb

A fast, local first, reactive Database for JavaScript Applications https://rxdb.info/
https://rxdb.info/
Apache License 2.0
21k stars 1.02k forks source link

401 Unauthorized access to CouchDB #71

Closed chopfitzroy closed 7 years ago

chopfitzroy commented 7 years ago

Case

401 Unauthorized access to CouchDB

Issue

Working with the Vue example I have updated:

const syncURL = 'http://' + window.location.hostname + ':10101/';

To

const syncURL = 'http://' + window.location.hostname + ':5984/';

Now when I open it up in the browser I get the following error:

PUT http://localhost:5984/heroes/ 401 (Unauthorized)
Uncaught (in promise) Error: [object Object]
    at Sync.eval (eval at <anonymous> (build.js:2054), <anonymous>:1043:43)
    at Sync.EventEmitter.emit (eval at <anonymous> (build.js:1247), <anonymous>:81:17)
    at eval (eval at <anonymous> (build.js:4013), <anonymous>:943:12)

Info

Code

Forked repo here: https://github.com/CrashyBang/rxdb

Have scoured docs/code for password/username config for CouchDB but had no luck.

Cheers.

chopfitzroy commented 7 years ago

Got it I simply had to change the URL to:

const syncURL = 'http://' + 'user:pass@' + window.location.hostname + ':5984/';

Refer here.