Hello, I am making an app using Wordpress and Ionic.
I setup a login which works fine on browser but when I try to test the app in Ionic PRO, my login doesn’t work. It doesn’t alert any error, only shows loading screen and nothing happens after that.
I also tried viewing the app in xcode and on login I receive a 501 not implemented server error.
I tried contacting server support to see if the problem is CORS related but they haven’t been able to resolve my issue.
Here is the coded from the provider:
postLogin(username, password){
let data = {
username: username,
password: password
};
let headers = new HttpHeaders();
headers.set('Content-Type', 'application/json');
return this.http.post(this.api_url, data, {headers: headers});
}
And in the Login page I call the function like this:
onLogin() {
this.presentLoading();
this.authProvider.postLogin(this.username, this.password).subscribe(data => {
this.navCtrl.setRoot('MenuPage');
localStorage.setItem('wpToken', JSON.stringify(data));
this.loader.dismiss();
}, error =>{ alert(JSON.stringify(error))});
}
I followed this tutorial for my login - https://www.youtube.com/watch?v=kiXs7hrmmmg&t=
I tried several different approaches but none of them made any difference.
Hope someone here as any idea what my problem is related to.