Dear All,
I just released my first app (in alpha) and have run into a major roadblock. The app logs into a website using HTTP(S) POST.
The code is as follows:
local headers = {} headers["Accept"] = "\*/\*" headers["Accept-Encoding"] = "" headers["Accept-Language"] = "en-US" headers["Content-Type"] = "application/x-www-form-urlencoded" local body = "POST body with username and password" local params = {} params.headers = headers params.body = body params.timeout = 30 print("Calling networkListenerLogin") network.request( "targetURL", "POST", networkListenerLogin, params)
There is 1 important thing of note:
If the entered password is incorrect, the targetURL returns HTTP 200 and “login failed” HTML text.
If the entered password is correct, the targetURL returns 302 Found and forwards to logged in welcome page.
Problem: The “Calling networkListenerLogin” gets printed in adb logcat, but the control does not reach networkListenerLogin when correct username / password are used. Test cases are as follows:
-
works on Windows simulator
-
works on MacOS simulator
-
works on Nexus 4 (stock android)
-
does not** work** on Samsung Galaxy S3
-
does not** work** on HTC One
-
works on iOS simulator
-
works on actual ipad device
It reaches networkListenerLogin when wrong password is used for all devices.
Question: is it the HTTP 302 which is messing it up?
Kindly help as considerable effort has gone into App Dev and this is really a nasty shocker after releasing it in alpha.
Many thanks,
Anshuman