These are chat archives for angular/angular-2-ionic-2

29th
Jun 2017
Abhilash
@abhibly
Jun 29 2017 08:24

Hello i have deployed my project in ionic view where i need to make a http call to remote server.I have implemented proxies like this

{
 "name": "MobileUI",
 "app_id": "608c237d",
 "type": "ionic-angular",
 "proxies": [
   {
    "path": "/Auth",
    "proxyUrl": "https://example.com/Auth/Authenticate",
     "rejectUnauthorized": false
    }
  ]
}

And I make a login call to the from the provider like this

  AuthenticateUser(username: string, password: string) {
var userNamePwd: any = {};
userNamePwd.username = username;
userNamePwd.password = password;
let body = JSON.stringify(userNamePwd);
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
return this.http.post('/Auth', body, options)
  .map((res) => {
    let data = this.extractData(res);
    this.storage.set('id_token', data[0].Token);
    this.sharedAuth.SetEntityData(data);
    return data;
  })
  .catch(this.handleError);
 }

The Login works perfectly when testing in web browser but when i upload the app in my ionic view i am getting this error response with status 0 for url null.I implemented the proxies in the way mentioned in http://blog.ionic.io/handling-cors-issues-in-ionic/ . Am I missing something ?

OLayemii
@OLayemii
Jun 29 2017 21:15
Hi