AzureAD / azure-activedirectory-library-for-js

The code for ADAL.js and ADAL Angular has been moved to the MSAL.js repo. Please open any issues or PRs at the link below.
https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/maintenance/adal-angular
Apache License 2.0
627 stars 372 forks source link

Endless redirect after successful login (Angularjs 1.4.9 & adal-angular 1.017) #860

Closed jgschwend closed 4 years ago

jgschwend commented 5 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[x] Other... Please describe:
It might be either a bug or maybe I just missed something.
Since the update to Chrome 73 we are getting endless redirect after the authentication against AAD.
It happened with firefox even before

Browser:

Library Name

Library version

Library version: 1.0.17

Current behavior

After login into AAD you get back to the application landing page. Afterwards there is a endless redirect between the app landing page and AAD. Authentication was successful and token has been provided.

Expected behavior

Expected behaviour would be to stay on the landing page.

Minimal reproduction of the problem with instructions

Unfortunately I wasn't able to reproduce in any other apps so far. My current setup:

Init of adal-angular in module.js:

          adalProvider.init(
          {
              instance: configData.authConfig.instance,
              tenant: configData.authConfig.tenant,
              clientId: configData.authConfig.clientId,

              endpoints: endpoints
          },
          $httpProvider
        );

Landing page controller (first page where we need to click login)

angular.module('hatch.deliciousdishes.landingPage')
  .controller('LandingPageCtrl', ['adalAuthenticationService', '$location', 'DateService', 'PromotionMenus',
    function (adalService, $location, DateService, PromotionMenus) {
      var vm = this;

      vm.data = DateService.data;

      vm.login = function login() {
        adalService.login();
      };

      function loadDailyOffersOfWeek() {
        return PromotionMenus.get({}, function (promotionMenus) {
          vm.promotionMenus = promotionMenus;
        }, function () {
          vm.promotionMenus = {};
        }).$promise;
      }

      function init() {
        if (adalService.userInfo.isAuthenticated) {
          $location.path('/weeklymenu');
        } else {
          loadDailyOffersOfWeek();
        }
      }

      init();

    }]);

After Login you will be redirected to the main page and you will hit the main routeconfig:

angular.module('hatch.deliciousdishes').config(function (TEMPLATE_ROOT_PATH, ProtectedRouteProvider) {
   ProtectedRouteProvider
      .otherwise({
         redirectTo: '/landing'
      });
});

jmckennon commented 4 years ago

This loop is a known bug in adal js, and is fixed in msal js. Some browsers will handle this differently, and some users have stated that clearing the browser cached helped fix this.

adal js is still supported only for security fixes. All current authentication work from Microsoft is delivered through the msal js library here. We recommend moving to msal js for any advanced feature requests and bugfixes.