0

I'm having the following problem with the API fetch on android devices:

Error

Here is the fetching code:

login(user,password) {
    let query = oauthManager.loginUrl(user,password);
    console.log(query);

    return fetch(query)
    .then(response => response.json())
        .then(json => {
            //Error
            if( json.error ){
            console.log(json.error);
            return false
        }

        //Save and return token
        return oauthManager
          .saveOauth(json)
          .then(() => {
            return oauthManager.saveUser(user)
          })
          .then(() => {
            return oauthManager.getToken()
          })
          .then(token => {
            console.log(token);
            return true
          });
    })
    .catch((error) => {
      console.log(error)
    });
  },

The scripts works fine on ios devices. Any ideas on why is this happening?

Thank you very much

2
  • Is it a localhost api or resource?, are you using physical device or simulator? Commented May 4, 2017 at 12:29
  • 1
    It is not a localhost resource, I'm using a GET fetch to an online server. It doesn't work on simulator and on physical devices either. Commented May 4, 2017 at 14:06

1 Answer 1

3

Well, I had to do some research and go down to Android. Seems like it was an SSL certificate issue in the server. If anyone has this issue I'd recommend to do the same: try to make the request on a native platform and get an error which is understandable there. I hope this will save someone's time

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.