Hosting an Ionic 2 app on web server using Backand SDK and auth

91 Views Asked by At

I am building an app using Back& as BaaS as well as using their authentication service. The login page is the root page, it's the first to load. While it runs fine on my local machine with "ionic serve" authorization does not work when running on a web server, neither on my local machine nor on Back&'s hosting service. Here's the code I'm using (straight from Back&'s example app):

this.backand.signin(this.username, this.password)
  .then((res: any) => {
    this.loggedInUser = res.data.username;
  },
  (error: any) => {
    alert(error.data);
  }
);

When attempting to login I get an empty error message. Interestingly anonymous auth works just fine (this.loggedInUser is 'Guest').

this.backand.useAnonymousAuth()
  .then((res: any) => {
    this.loggedInUser = res.data.username;
  },
  (error: any) => {
    alert (error.data);
  });

backand/angular2-sdk: v1.1.2

1

There are 1 best solutions below

1
E. Tallas On

I feel kind of stupid that I haven't tested it earlier - the issue only shows up when using Chrome on my dev machine, no issue if using any other browser on that same machine, or even the same version of Chrome but on a different machine. Sorry for wasting your time guys!