seigel/pouchdb-react-native

Can't make it work with PouchDB Authentication

Closed this issue · 1 comments

mqtik commented

Hello everyone,

I'm trying to make this work with the plugin PouchDB Authentication,
with no luck.

It throws an error:
Reference error: Blob is not defined

I tried to install another library reading blob, change the source code, among other things,
but still wont work.

import PouchDB from 'pouchdb-react-native'
import PouchDBAuthentication from 'pouchdb-authentication'

PouchDB.plugin(PouchDBAuthentication)
const remoteDB = new PouchDB('http://mqserv.com:5489/_users', {skip_setup: true}) // also tried without /_users endpoint
remoteDB.signUp(username, password, function (err, response) {
  if (err) {
    if (err.name === 'conflict') {
      console.log("Already exists")
    } else if (err.name === 'forbidden') {
      // invalid username
      console.log("Username invalido")
    } else {
      console.log("ERROR:", err)
      
      // HTTP error, cosmic rays, etc.
       //  (here is where I am)
    }
    
  }
});

Hope you can help me out with this.

Kind regards.

mqtik commented

The problem was due to a React Native versión, since version 16 they introduced Blobs.

Closing.