Reputation: 1247
I'm having the following problem with the API fetch on android devices:
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
Upvotes: 0
Views: 1184
Reputation: 1247
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
Upvotes: 3