carlos
carlos

Reputation: 845

Angularjs page using adaljs keeps going for a token

I have a very simple application with HTML, AngularJS and I want to use adal-js and adal-angular-js. The app is this:

var app = angular.module('myApp', ['ngRoute', 'AdalAngular']);
app.config([
    '$routeProvider', '$httpProvider', 'adalAuthenticationServiceProvider', 
    function ($routeProvider, $httpProvider, adalProvider) {

        $routeProvider
            .when('/', {
                templateUrl: "App/Views/home.html",
                controller:'myCtrl',
                requireADLogin:true,
            }).when("/autenticado", {
                templateUrl: "App/Views/autenticado.html",
                controller:'authCtrl',
            });

        adalProvider.init(
            {
                instance: 'https://login.microsoftonline.com/',
                tenant: 'supervisorxher34outlook.onmicrosoft.com',
                clientId: 'e5b17ad1-8f2d-4716-a9ad-748c48222e23',
                extraQueryParameter: 'nux=1',
                //cacheLocation: 'localStorage', // enable this for IE, as sessionStorage does not work for localhost.
            },
            $httpProvider
        );
    }
]);

The home HTML, is just a simple hello world.

When I enter the page, it redirects me to the login page, but as soon as I put my username and password it keeps refreshing endlessly, and never stops.

Any idea why is this happening?

Thanks!

Upvotes: 1

Views: 142

Answers (1)

carlos
carlos

Reputation: 845

A little bit ashamed, but the answer was so easy:

 $locationProvider.html5Mode({
        enabled:true,
        requireBase: false
    }).hashPrefix('!');

Just needed to add the $locationProvider.

Upvotes: 0

Related Questions