angularjs - Angular $HTTP returns 404 in PhoneGap (works in browser) -
i trying login in angular app packaged using phonegap build.
when run app in browser works fine , can login using api call remote server (so no server cors issues).
when try use same code in phonegap app 404 response server
phonegap request/response
request url:http://budget.expectbrilliant.com/auth/local request method:post status code:404 not found404 not found request payload {"email":"ben@cogiva.com","password":"nebjam2n"} response headers client-via:shouldinterceptrequest
browser request/response:
request url:http://budget.expectbrilliant.com/auth/local request method:post status code:200 ok remote address:46.101.93.76:80 response headers access-control-allow-origin:* connection:keep-alive content-length:184 content-type:application/json; charset=utf-8 date:sat, 16 jan 2016 12:50:08 gmt vary:accept-encoding x-powered-by:express request headers accept:application/json, text/plain, */* accept-encoding:gzip, deflate accept-language:en-gb,en-us;q=0.8,en;q=0.6 authorization:bearer eyj0exaioijkv1qilcjhbgcioijiuzi1nij9.eyjfawqioii1njg3zgvkndexndzjodhhmdc0zjrjmjyilcjpyxqioje0nti5ndg1otcsimv4cci6mtq1mjk2nju5n30.cjfvi4yed2qtde_vlamack9-ozca8s2jn3btmk2vnia connection:keep-alive content-length:48 content-type:application/json; charset=utf-8 host:budget.expectbrilliant.com origin:http://localhost:9000 referer:http://localhost:9000/ user-agent:mozilla/5.0 (macintosh; intel mac os x 10_11_2) applewebkit/537.36 (khtml, gecko) chrome/47.0.2526.106 safari/537.36 request payload {email: "ben@cogiva.com", password: "nebjam2n"} email: "ben@cogiva.com" password: "nebjam2n"
this http call:
login: function(user, callback) { var cb = callback || angular.noop; var deferred = $q.defer(); $http.post($rootscope.globalurl + '/auth/local', { email: user.email, password: user.password }). success(function(data) { $cookiestore.put('token', data.token); currentuser = user.get(); deferred.resolve(data); return cb(); }). error(function(err) { this.logout(); deferred.reject(err); return cb(err); }.bind(this)); return deferred.promise; },
i've tried solutions suggested elsewhere, can't response other 404.
edit
this first phonegap app , using phonegap build. targeting android 4.4 , (but want release ios eventually).
any ideas?
Comments
Post a Comment