Webapp infinite loop in edge

时间:2017-10-12 10:11:10

标签: angularjs typescript active-directory microsoft-edge adal

I am using angular js in my azure webapp. It uses adal and adal-angular.js for authentication. Now when I open in Edge its going into infinite loop. I have added logging but since it refreshes every time , developer tools is getting closed and I am not able to see any logs.

any workaround to see developer tools and console logs.

I have tried different solutions mentioned at different links

https://github.com/AzureAD/azure-activedirectory-library-for-js/issues/216 https://github.com/AzureAD/azure-activedirectory-library-for-js/issues/537

But none of these worked.Any suggestions

Here is app.js

var app = angular.module("appModel", ["ui.router", "ngRoute", "AdalAngular", "angularjs-dropdown-multiselect", "ngAnimate", "ngSanitize", "ui.bootstrap", "rzModule", "angulartics", "angulartics.application.insights","ngCookies"]);

app.run(['$rootScope', '$http', '$location', '$urlRouter', 'adalAuthenticationService', '$interval', '$state', '$stateParams', '$uibModal', '$document', '$sce', ($rootScope, $http, $location, $urlRouter, adalAuthenticationService: adal.AdalAuthenticationService, $interval, $state, $stateParams, $uibModal, $document, $sce, Logger) => {

    $rootScope.init = function () {
        debugger;
        console.log("app controller init");
    };

    $rootScope.login  = function () {
        console.log("app controller login");
        adalAuthenticationService.login();

    };

    $rootScope.logout = function () {
        console.log("app controller logout");
        adalAuthenticationService.logOut();
    };

    $rootScope.$on("adal:loginSuccess",function(){
        console.log("app controller loginSuccess");
    });

    $rootScope.$on("adal:loginFailure", function () {
        console.log("app controller loginFailure");
        $location.path("/login");
    });

    $rootScope.$on("adal:notAuthorized", function (event, rejection, forResource) {
        console.log( "It is not Authorized for resource:" + forResource);
    });
}]);


app.config(($stateProvider, $urlRouterProvider, $httpProvider: angular.IHttpProvider, adalAuthenticationServiceProvider, $locationProvider) => {
        window["Logging"] = {
            level: 3,
            log(message) {
                console.log(message);
            }
        };

        var adalConfig = {
            tenant: constants.TenantId,
            clientId: constants.ClientId,
            requireADLogin: true,
            cacheLocation: 'sessionStorage'
        };

        if (navigator.appName == 'Microsoft Internet Explorer'
            || (navigator.appName == "Netscape" && navigator.appVersion.indexOf('Edge') > -1)) {
            adalConfig = {
                tenant: constants.TenantId,
                clientId: constants.ClientId,
                requireADLogin: true,
                cacheLocation: 'localStorage'
            }
        } 

        $locationProvider.html5Mode(true).hashPrefix('!');


        adalAuthenticationServiceProvider.init(
            adalConfig,
            $httpProvider
        );

        if (window !== window.parent)
            return;



        $stateProvider
            .state("home", {
                url: "/home",
                templateUrl: "App/Scripts/home.html",
                requireADLogin: true,
                controller($scope, $rootScope, $cookies, $window) {
                    $scope.environment = $window.environment;
                    $rootScope.showBlade = false;

                }
            })


            .state("otherwise", {
                url: "*path",
                requireADLogin: true,
                templateUrl: "App/Scripts/home.html"
            })
    });

0 个答案:

没有答案
相关问题