Solved - Trouble With Login Through POST on Device


#1

I’m using the super starter as the basis for my app and everything works perfectly when I’m using ionic serve. However if I run ionic cordova build ios --prod and deploy it to a device or try in emulation using ionic cordova emulate ios -lc I’m not able to get past the Login page.

What I’ve tried:
I setup the controller that perform the login (in PHP) and log php://input, $_POST, and $_GET to a file so I could see what’s being sent (I added $_POST and $_GET after php://input didn’t show anything). When I attempt to login using ionic serve it logs the data I expect but if I’m in IOS nothing is sent.

I was able to get it to send data by JSON.stringifying the body variable in the Api::post function which causes data to be in php://input but then the system doesn’t seem to process the result correctly.

Any suggestions on where to look to troubleshoot this?


#2

After some more troubleshooting (using Safari to connect remotely [not sure why I didn’t think of that sooner]). I found I needed to set Access-Control-Allow-Origin to *, and Access-Control-Allow-Headers to “Origin, X-Requested-With, Content-Type, Accept” because it was making an option request which was failing.


#3

Is your Problem solved? When it is solved please mark it as solved.:wink: