cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Kremmel (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CB-4000) IOS - Ajax Return Code 401 let app crash
Date Wed, 26 Jun 2013 07:34:19 GMT

     [ https://issues.apache.org/jira/browse/CB-4000?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Thomas Kremmel updated CB-4000:
-------------------------------

    Description: 
I'm experiencing an issue when the server returns 401 status code after the client made an
ajax call via a Angularjs $resource. The issue is that after receiving the 401 code the controller
is re-entered multiple times, having to quit the application. Interestingly the app behaves
normal if the server returns a 403 status code.

angular.module('AngularApp')
.controller('DashboardCtrl',
    ['$rootScope', '$scope', 'PersonalOverviewResource', function($rootScope, $scope, PersonalOverviewResource)
{
        console.log("in dashboard CTRL");
        PersonalOverviewResource.getData({}, function(result, getResponseHeaders) {
            console.log("received a result from backend");
        },function(response) {
             console.log("error; code: " + response.code + ";");
        });
    }]);

angular.module('AngularClientSideAuth')
.factory('PersonalOverviewResource', function($rootScope, $resource) {
	return $resource($rootScope.backend_domain.concat("api/overview/user"), {},{
		getData: {method:'GET', isArray: false}
	});
});

In addition I want to provide this SOF question, as the problem seems to be the same ( app
crashes when server returns 401)
http://stackoverflow.com/questions/16897271/handle-401-unauthorized-error-on-windows-phone-with-phonegap

Stacktrace from my Xcode console:

2013-06-26 09:37:19.111 AngularPhoneGapClientSideAuth[61492:c07] success - redirecting to
/ --> successful login
2013-06-26 09:37:19.129 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.130 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.173 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401; -->
unauthorized access because I did not set auth token correctly
2013-06-26 09:37:19.195 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.195 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.199 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.220 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.221 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.224 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.252 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.252 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.257 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.277 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.277 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.280 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.301 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.301 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.309 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.325 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.326 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.329 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.348 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.348 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.351 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.367 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.367 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.370 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.385 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.385 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.388 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.403 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.404 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.406 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.422 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.422 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.425 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.445 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.445 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.447 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.465 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.465 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.467 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.482 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.482 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.484 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.499 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.499 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.503 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.519 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.519 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.522 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.538 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.538 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.540 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.557 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.557 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.559 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.587 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.587 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.590 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.604 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.604 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.607 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.621 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.621 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.624 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.639 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.640 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.642 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.656 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.656 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.658 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.672 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.673 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.675 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.693 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.694 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.696 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.711 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.711 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.713 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.727 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.728 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.730 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.747 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.747 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.757 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401



  was:
I'm experiencing an issue when the server returns 401 status code after the client made an
ajax call via a Angularjs $resource. The issue is that after receiving the 401 code the controller
is re-entered multiple times, having to quit the application. Interestingly the app behaves
normal if the server returns a 403 status code.

angular.module('AngularApp')
.controller('DashboardCtrl',
    ['$rootScope', '$scope', 'PersonalOverviewResource', function($rootScope, $scope, PersonalOverviewResource)
{
        console.log("in dashboard CTRL");
        PersonalOverviewResource.getData({}, function(result, getResponseHeaders) {
            console.log("received a result from backend");
        },function(response) {
             console.log("error");
        });
    }]);

angular.module('AngularClientSideAuth')
.factory('PersonalOverviewResource', function($rootScope, $resource) {
	return $resource($rootScope.backend_domain.concat("api/overview/user"), {},{
		getData: {method:'GET', isArray: false}
	});
});

In addition I want to provide this SOF question, as the problem seems to be the same ( app
crashes when server returns 401)
http://stackoverflow.com/questions/16897271/handle-401-unauthorized-error-on-windows-phone-with-phonegap

Stacktrace from my Xcode console:

2013-06-26 09:37:19.111 AngularPhoneGapClientSideAuth[61492:c07] success - redirecting to
/ --> successful login
2013-06-26 09:37:19.129 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.130 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.173 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401; code: 401
--> unauthorized access because I did not set auth token correctly
2013-06-26 09:37:19.195 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.195 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.199 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.220 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.221 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.224 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.252 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.252 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.257 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.277 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.277 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.280 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.301 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.301 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.309 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.325 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.326 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.329 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.348 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.348 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.351 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.367 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.367 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.370 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.385 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.385 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.388 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.403 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.404 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.406 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.422 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.422 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.425 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.445 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.445 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.447 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.465 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.465 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.467 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.482 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.482 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.484 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
2013-06-26 09:37:19.499 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.499 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.503 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.519 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.519 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.522 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.538 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.538 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.540 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.557 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.557 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.559 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.587 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.587 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.590 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.604 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.604 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.607 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.621 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.621 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.624 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.639 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.640 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.642 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.656 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.656 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.658 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.672 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.673 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.675 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.693 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.694 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.696 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.711 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.711 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.713 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.727 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.728 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.730 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in dashboard
Graph Ctrl
2013-06-26 09:37:19.747 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.747 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
2013-06-26 09:37:19.757 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401



    
> IOS - Ajax Return Code 401 let app crash
> ----------------------------------------
>
>                 Key: CB-4000
>                 URL: https://issues.apache.org/jira/browse/CB-4000
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 2.8.0
>         Environment: OSX 10.8.4 running XCode 4.6.3 and IPad 6.1 Simulator. Using AngularJS
1.1.4 
>            Reporter: Thomas Kremmel
>            Assignee: Shazron Abdullah
>              Labels: http, statuscode
>
> I'm experiencing an issue when the server returns 401 status code after the client made
an ajax call via a Angularjs $resource. The issue is that after receiving the 401 code the
controller is re-entered multiple times, having to quit the application. Interestingly the
app behaves normal if the server returns a 403 status code.
> angular.module('AngularApp')
> .controller('DashboardCtrl',
>     ['$rootScope', '$scope', 'PersonalOverviewResource', function($rootScope, $scope,
PersonalOverviewResource) {
>         console.log("in dashboard CTRL");
>         PersonalOverviewResource.getData({}, function(result, getResponseHeaders) {
>             console.log("received a result from backend");
>         },function(response) {
>              console.log("error; code: " + response.code + ";");
>         });
>     }]);
> angular.module('AngularClientSideAuth')
> .factory('PersonalOverviewResource', function($rootScope, $resource) {
> 	return $resource($rootScope.backend_domain.concat("api/overview/user"), {},{
> 		getData: {method:'GET', isArray: false}
> 	});
> });
> In addition I want to provide this SOF question, as the problem seems to be the same
( app crashes when server returns 401)
> http://stackoverflow.com/questions/16897271/handle-401-unauthorized-error-on-windows-phone-with-phonegap
> Stacktrace from my Xcode console:
> 2013-06-26 09:37:19.111 AngularPhoneGapClientSideAuth[61492:c07] success - redirecting
to / --> successful login
> 2013-06-26 09:37:19.129 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.130 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.173 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401; -->
unauthorized access because I did not set auth token correctly
> 2013-06-26 09:37:19.195 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.195 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.199 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
> 2013-06-26 09:37:19.220 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.221 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.224 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.252 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.252 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.257 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.277 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.277 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.280 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.301 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.301 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.309 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
> 2013-06-26 09:37:19.325 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.326 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.329 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
> 2013-06-26 09:37:19.348 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.348 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.351 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
> 2013-06-26 09:37:19.367 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.367 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.370 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
> 2013-06-26 09:37:19.385 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.385 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.388 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
> 2013-06-26 09:37:19.403 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.404 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.406 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
> 2013-06-26 09:37:19.422 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.422 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.425 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
> 2013-06-26 09:37:19.445 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.445 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.447 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
> 2013-06-26 09:37:19.465 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.465 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.467 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
> 2013-06-26 09:37:19.482 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.482 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.484 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401
> 2013-06-26 09:37:19.499 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.499 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.503 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.519 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.519 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.522 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.538 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.538 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.540 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.557 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.557 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.559 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.587 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.587 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.590 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.604 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.604 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.607 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.621 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.621 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.624 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.639 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.640 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.642 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.656 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.656 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.658 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.672 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.673 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.675 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.693 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.694 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.696 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.711 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.711 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.713 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.727 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.728 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.730 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401 in
dashboard Graph Ctrl
> 2013-06-26 09:37:19.747 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.747 AngularPhoneGapClientSideAuth[61492:c07] in dashboard CTRL
> 2013-06-26 09:37:19.757 AngularPhoneGapClientSideAuth[61492:c07] error; code: 401

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message