Http POST Connection ERROR

Hello, thanks to all community for the help.

I have a problem with my controller, when I try to ‘sig in’ in my app using the movil device, I can not connect with the server, but when I try the same code in the browser I do not have problem to connect or work with the app.
This problem only appear when I am working from movil device.

This is my controller code:

.controller(‘LoginCtrl’, function($scope, $state, $http, UserFtry) {
$scope.logIn = function(user){
$scope.user = {};
$scope.user.username = “”;
$scope.user.password = “”;

    if(user == null){
        $scope.user.response = "Debe rellenar los campos Usuario y Contraseña.";
        $scope.user.username = "";
        $scope.user.password = "";
        return $http({            
            url : '/loginAccess', 
            method : 'POST', 
            data : {'usuario': user.username,'password': user.password},
            headers : { 'Content-Type' : 'application/json' }
        }).success(function(result) {
            if (result == "Error"){
                $scope.user.response = "Usuario o contraseña incorrectos.";
                $scope.user.usuario = "";
                $scope.user.password = "";
       = result[0];
            $scope.user.response = "Error de conexión";


I have tried different codes but I always get the same result. I can not obtain the success result, only error, as I said this only happens on movil device.

I am working in ANDROID platform.

Thanks for all.

does you have added the whitelist plugin to your project?

You have to allow outgoing requests to your server

Assuming you get your white-list plugin setup correctly, I still had to disable the user of my proxy.

Are you using a proxy in your ionic.project to map “/loginAccess” to some

When I deploy to android, I have to do two things. Turn off the proxy, and change my URL to the full server url.

1 Like

Thanks for all, I can already solved this problem.
The problem was in the proxies that need to be turned off to create the package, and use the server URL instead off the proxy address.

Now work correctly in the mobile device.