witoldsz/angular-http-auth

Stopped working on iOS with angular 1.2

irhtml opened this issue · 10 comments

It seems that the interceptor is not working on iOS with angular 1.2
Nothing gets intercepted on http calls. Anyone else with this issue?
Tested on a iphone 5, using phonegap / angularjs.

It works with angularjs 1.2.0rc2 but not the stable 1.2

Not sure about mobile, but it's working fine as fair as I can tell on 1.2.1 on desktop.

After some more testing I also found its working in Chrome, but not Firefox.. very strange

maybe you can try to debug and follow the debugging?


Diego
Mobile: +55 27 99747-7157

skype diego@sv2.com.br
facebook.com/diego.souza.vieira
twitter.com/diegophp
linkedin.com/in/diegocs

On Wed, Nov 20, 2013 at 8:59 AM, toppetoppe notifications@github.comwrote:

After some more testing I also found its working in Chrome, but not
Firefox.. very strange


Reply to this email directly or view it on GitHubhttps://github.com//issues/50#issuecomment-28878825
.

Tested with 1.2.0.rc1 and rc2 works fine, but not with 1.2.1 and 1.2.0, only broken in mobile for me.

edit: in firefox the rejection.status is 0

Does anyone have more info regarding the issue?

The demo app works for me on ipad with iOS 7.0.4 in both Chrome and Safari. As far as I can tell, there is no Firefox for iOS. https://support.mozilla.org/en-US/kb/is-firefox-available-iphone-or-ipad

I'll try Firefox on a desktop tomorrow, but this issue says iOS and the follow up comment mentions Firefox which makes no sense to me.

OK, I am closing this as it's like "something is maybe broken somewhere" kind of issue.
Please reopen if you have anything useful.

I am having the same issues. Works well in browsers, but not working when creating a phonegap app. The problem is that the loginConfirmed event is broadcasted, but the listener is never triggered. So it seems like something went wrong there. I don't know if it is the angular update or iOS update, but since it works in the browser it seems to be related to iOS only.

More info on this. I've added a log, so I can see that loginConfirmed is actually called and it is.

            loginConfirmed: function (data, configUpdater) {
                var updater = configUpdater || function (config) { return config; };
                $rootScope.$broadcast('event:auth-loginConfirmed', data);
                console.log('auth-loginConfirmed broadcasted');
                httpBuffer.retryAll(updater);
            },

This is then the directive I am using to listen for the events:

angular.module('thinktoscore.directives.auth', []).
        directive('authApp', ['$rootScope', '$localStorage', 'NotificationService', 'UserService', function ($rootScope, $localStorage, NotificationService, UserService) {
            return {
                restrict: 'C',
                scope: {},
                link: function (scope) {
                    $rootScope.$on('event:auth-loginRequired', function () {
                        console.log("login required!");
                        UserService.Logout();
                        NotificationService.Exit();
                        $.ui.loadContent('login', true, false, 'none');
                        if (navigator.splashscreen !== undefined) {
                            navigator.splashscreen.hide();
                        }
                    });
                    $rootScope.$on('event:auth-loginConfirmed', function () {
                        console.log('event:auth-loginConfirmed received!');
                        if ($localStorage.User.FirstName !== null && $localStorage.User.LastName !== null && $localStorage.User.Team !== null && $localStorage.User.Team.Name !== null &&
                            $localStorage.User.FirstName !== '' && $localStorage.User.LastName !== '' && $localStorage.User.Team.Name !== '') {
                            NotificationService.Init();
                            $.ui.loadContent('start', true, false, 'none');
                        } else {
                            $.ui.loadContent('setup', false, false, 'slide');
                        }
                        if (navigator.splashscreen !== undefined) {
                            navigator.splashscreen.hide();
                        }
                    });
                }
            };
        }]);

I have tried to listen on both scope and rootScope. Both of them work in the browser, but when running it in iOS through PhoneGap it is not working. Any ideas why the listeners are not triggered?

It turned out to be a completely different thing, that caused this behavior to happen. I am using Intel App Framework and when adding a scroller to a div, this occurred. I can confirm that I have http-auth-interceptor working with angular 1.2.7 and PhoneGap 3.3.0. So maybe your problem, @toppetoppe, was also caused by something else?