You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Thomas Kremmel (JIRA)" <ji...@apache.org> on 2013/06/26 09:30:27 UTC

[jira] [Comment Edited] (CB-4000) IOS - Ajax Return Code 401 let app crash

    [ https://issues.apache.org/jira/browse/CB-4000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13693801#comment-13693801 ] 

Thomas Kremmel edited comment on CB-4000 at 6/26/13 7:30 AM:
-------------------------------------------------------------

Today I also recognized that their are two types of behaviour after receiving a 401 in my setup (using AngularJS).

1. App goes out of control and controller is re-entered infinitely, having to stop the application via XCode
2. App crashes and UI seems to be unable to execute JS (for example clicking a button has no effect)

Whereas I cannot judge what the reasons are that number one or number two occurs.
I updated the issue to include my stacktrace.
                
      was (Author: thomaskre):
    Today I also recognized that their are two types of behaviour after receiving a 401 in my setup (using AngularJS).

1. App goes out of control and controller is re-entered infinitely, having to stop the application via XCode
2. App crashes and UI seems to be unable to execute JS (for example clicking a button has no effect)

Whereas I cannot judge what the reasons are that number one or number two occurs.
                  
> 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");
>         });
>     }]);
> 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

--
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