mongodb / stitch-js-sdk

MongoDB Stitch JavaScript SDK
Apache License 2.0
113 stars 67 forks source link

CouldNotPersistAuthInfo on Android with LoginWithCredential() #243

Closed wgarrido closed 5 years ago

wgarrido commented 5 years ago

Hello, I have an issue on Android when i try to connect with LoginWithCredential method.

let credential = new UserPasswordCredential(this.state.mail, this.state.password)
    this.state.client.auth.loginWithCredential(credential)
      .then(authedUser => {
        this.props.navigation.navigate('App', {client: this.state.client})
      })
      .catch(err => {
        console.error(`login failed with error: ${err}`)
      })

This code return an Error on Android only (Work fine on IOS)

(CouldNotPersistAuthInfo): failed to save auth information for Stitch

After this error when I reload I'm logged ...

  "mongodb-stitch-react-native-core": "^4.3.1",
  "mongodb-stitch-react-native-sdk": "^4.3.1",
  "react": "16.6.3",
  "react-native": "0.58.4",

Do you have a solution ? Thank you

tkaye407 commented 5 years ago

Hi @wgarrido, I tried to reproduce this with the following depencies using expo, but was unable to.

"expo": "^32.0.0",
"mongodb-stitch-react-native-sdk": "^4.3.1",
"react": "16.6.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz"

Are you getting this issue every time that you try to login? Is it happening only with UserPasswordCredentials?

These details will help me contonue to look into your issue.

Thanks, Tyler

tkaye407 commented 5 years ago

As an update, I was able to confirm this bug running pure react-native (without expo), I will be sure to keep you updated as we figure out a solution.

wgarrido commented 5 years ago

Ok thank's a lot @tkaye407

tkaye407 commented 5 years ago

This issue should be remedied by https://github.com/mongodb/stitch-js-sdk/commit/d8aa84a6d230846b7ccae4031b60ea16c89f15fb . We were using ES5 syntax not supported by react native iterating over a map. We will try to release this fix soon, but in the meantime I can send you a zip to plugin to your node modules if you would like?

wgarrido commented 5 years ago

Thank you very much ! Yes In the meantime the patch I would like a zip to test please. Sorry for my english.

tkaye407 commented 5 years ago

Hi, I apologize for not getting back sooner. We just released JS SDK 4.3.2 which fixes this problem. I personally just tested it, so please let me know if you run into any problems.

wgarrido commented 5 years ago

Hello @tkaye407 It's work fine !! Thank's a lot.