{"action":"closed","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4175","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4175/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4175/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4175/events","html_url":"https://github.com/pouchdb/pouchdb/issues/4175","id":101618382,"number":4175,"title":"Unkown error during authentication","user":{"login":"csysmans","id":13849181,"avatar_url":"https://avatars.githubusercontent.com/u/13849181?v=3","gravatar_id":"","url":"https://api.github.com/users/csysmans","html_url":"https://github.com/csysmans","followers_url":"https://api.github.com/users/csysmans/followers","following_url":"https://api.github.com/users/csysmans/following{/other_user}","gists_url":"https://api.github.com/users/csysmans/gists{/gist_id}","starred_url":"https://api.github.com/users/csysmans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csysmans/subscriptions","organizations_url":"https://api.github.com/users/csysmans/orgs","repos_url":"https://api.github.com/users/csysmans/repos","events_url":"https://api.github.com/users/csysmans/events{/privacy}","received_events_url":"https://api.github.com/users/csysmans/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pouchdb/pouchdb/labels/enhancement","name":"enhancement","color":"02d7e1"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-08-18T09:58:08Z","updated_at":"2015-10-06T21:38:04Z","closed_at":"2015-10-06T21:38:04Z","body":"I'm using PouchDB 4.0. To test the credentials to a remote CouchDB server, I use the following code:\r\n```\r\ntestCredentials: function(credentials, callback){\r\n        var remoteDb = new PouchDB('http://X.X.X.X/dbName', {\r\n            auth: {\r\n                username: credentials.username,\r\n                password: credentials.password\r\n            }\r\n        });\r\n\r\n        remoteDb.info(function(err, info) {\r\n            if (err) { \r\n                if(err.status == 401)\r\n                    callback(\"unauthorized\");\r\n                else {\r\n                    console.log(err); \r\n                    callback(\"error\");\r\n                }\r\n            } else {\r\n                callback(\"success\");\r\n            }\r\n        });\r\n}\r\n```\r\n\r\nWhen I pass invalid credentials (e.g. existing user but invalid password), I see a 401 error returned inside the CouchDB log file. However, PouchDb always returns the following 500 error:\r\n```\r\n{\"status\":500,\"name\":\"unknown_error\",\"message\":\"Database encountered an unknown error\",\"error\":true}\r\n```\r\nThe same problem occurs when using the pouchdb-authentication plugin.\r\nThis code worked perfectly in previous versions of PouchDB.\r\n"}}