Closed mbambirra closed 5 years ago
Hi KaelM, this might have to do with the AuthSession cookie. If you go into your browser's dev tools and don't see the AuthSession cookie then you'll get back a 401 Unauthorized message from your couch database when you try to access it.
If it's there an you are still getting a 401 Unauthorized message, it's probably due to the fetch API (PWAs use the fetch api) not including the AuthSession cookie when requesting data from the couch db. You need to provide the optionsDB default with an override to the fetch function to include credentials, which is different from when you use XHR. The code below is from the TypeScript example on the readme page of this project:
Vue.use(pouchVue,{
pouch: PouchDB,
defaultDB: 'todos',
optionsDB: {
fetch: function (url:any, opts:any) {
opts.credentials = 'include';
return PouchDB.fetch(url, opts);
}
}
})
See also issue #3
If that doesn't do it, let me know.
This issue may be fixed in the just released pouchdb v7.1: It was a bug and the adapter now includes options.credentials = 'include';
Please reopen if you have any further problems.
When i try to sync local pouchdb with remote couchdb i get "401 (Unauthorized)".
I'm trying to do this: