Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ui-Router 404 when redirecting with ADAL

I'm currently trying to hook in the Azure Directory Authentication Library (ADAL.JS) into UI-Router. I've got it wired in, and it redirects correctly, but it always chucks a 404 before the redirect. The redirect works, and then gets sent back to my application, which is showing the 404.

I've modified the state like so:

        {
            state: 'admin',
            config: {
                url: '/admin',
                templateUrl: 'app/admin/admin.html',
                controller: 'AdminController',
                controllerAs: 'vm',
                title: 'Admin',
                settings: {
                    nav: 2,
                    content: '<i class="fa fa-lock"></i> Admin'
                },
                requireADLogin: true
            }

I've got it working with the normal Angular RouteProvider, and no 404 is being thrown.

The application I'm attempting to plumb it into was generated by John Papas Yo Hot Towel generator.

like image 671
John Mc Avatar asked Oct 19 '22 15:10

John Mc


1 Answers

This looks like a bug in adal.js. ui-router is using state changes. I see one difference in setting the start page for state changes comparing to the route change handler. It should be :

_adal._saveItem(_adal.CONSTANTS.STORAGE.START_PAGE, $location.$$path);

instead of

_adal._saveItem(_adal.CONSTANTS.STORAGE.START_PAGE, nextRoute.url);
like image 82
Omer Cansizoglu Avatar answered Nov 04 '22 21:11

Omer Cansizoglu