pouchdb-community / pouchdb-authentication

User authentication plugin for PouchDB and CouchDB.
Apache License 2.0
775 stars 118 forks source link

Authentication only works in Chrome? #242

Closed group131 closed 6 years ago

group131 commented 6 years ago

Expected Behavior

I try to use authentication plugin. In Chrome it works as described.

Current Behavior

In Firefox, it does not work due to CORS. Message follows: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://IP:5984/_session. (Reason: CORS request did not succeed). Obviously, I have CORS enabled and syncing PouchDB with CouchDB works in Firefox...

Possible Solution

Steps to Reproduce (for bugs)

var db_remote = new PouchDB('http://IP:5984/templates'); db_remote.logIn(username, password, function(err, response) { if (err) { console.log(err) if (err.name === 'unauthorized' || err.name === 'forbidden') { // name or password incorrect console.log(err.name) alert("Username or password is incorrect!") } else { // cosmic rays, a meteor, etc. alert("Something went wrong!") } } else { console.log(response) window.open("test.html", '_self'); } });

Context

I tried to follow the instructions to setup. The only thing I skipped is syncing the remote CouchDB to a local pouchDB. Could that be the problem?

Your Environment

group131 commented 6 years ago

Forgive my haste. It works on Firefox after all. Had a completely irrelevant error. Closing issue.