Ionic 2 code working on web but not on device

I’m working on login/signin. It is working on web but on android device its showing 403 error.

What’s the code you’ve used to create the login, where are you loging in to and what exact error are you receiving on your device?


Loginresponse : any;
    let data = {
      password: this.password

    (res) => {
      this.Loginresponse = res;
    (err) => {


public verifyUser(body){

  private extractData(res: Response) {
		if (res.status === 204) { return res; }
		let body = res.json();
		return body || { };

	private handleError(error: Response | any) {
    let errMsg: string;
    if (error instanceof Response) {
      errMsg = `${error.status} - ${error.ok || ''}`;
      if (error.status === 0) {
        errMsg = `${error.status} - "No Internet"`;
    } else {
      errMsg = error.message ? error.message : error.toString();
    return Observable.throw(errMsg);

and the error i’m reciving on device is “403-”.Preformatted text

Could you please format the code of your post by using < /> , it will make your post easier to read. Thanks. Okay so 403 means forbidden. You’re trying to access something which you don’t have the appropriate rights for. Did you already inspect the payload you’re sending to your server on your browser as well as on the device?

Yes i checked on both browser and device. Its working fine on browser but on device i’m getting “403-”.

I asked to check if you could make sure the payload is exactly the same. I understand it’s working in the browser, but if you want to figure out why it isn’t working on the device, I would start by inspecting the payload you’re trying to send to the server on the device.

Smells like a CORS issue to me.

1 Like