-
Notifications
You must be signed in to change notification settings - Fork 371
adal.js doesn't works with ui-router release 1 #574
Comments
I'm also having problems between ui-router (old version, < 1.x) and ADAL. In my case what I can see is that there must be some kind of issue between the ui-router navigation and the attempt to request Azure the navigation token (window.location.replace(urlNavigate); inside AuthenticationContext.prototype.promptUser in adal.js). In case it can help somebody, the following workaround has worked for me: set to false requireADLogin in the ui-router state and, after the state has loaded, call explicitly from the controller the public adalAuthenticationService.login() method. |
It works but obviously could be better. Just sharing for the interim.
Any updates on fixing this ? My project is also being held back due to this issue. |
Hi,
I implemented the workaround that I posted in Github.
In ui-router, the requireADLogin for the state is set to false.
In the controller (associated to the ui-router state in which I embed powerbi) I check if there is already a logged in user. If not, then I manually force the login.
adalAuthenticationService.getUser().then(function (user) { // es una promesa
console.log(user);
}, function (error) {
console.log(error);
adalAuthenticationService.login();
});
Also I had to modify manually adal-angular.js: the returned login method, as shown here:
return {
// public methods will be here that are accessible from Controller
config: _adal.config,
login: function () {
_adal.login($location.$$absUrl); // JAS#
// _adal.login();
},
loginInProgress: function () {
return _adal.loginInProgress();
Now it’s working for me. It’s an ugly procedure and I’m looking forward to somebody correcting the root cause of this issue between ui-router and adal-angular. Please, keep me updated if you find out a better solution.
Good luck!
De: Amit Olkar [mailto:notifications@github.com]
Enviado el: lunes, 02 de octubre de 2017 20:13
Para: AzureAD/azure-activedirectory-library-for-js
CC: gfsarri; Manual
Asunto: Re: [AzureAD/azure-activedirectory-library-for-js] adal.js doesn't works with ui-router release 1 (#574)
Any updates on fixing this ? My project is also being held back due to this issue.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#574 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AIXv_Nn-n0U-fmEVwqhvqRV7W8fkrbCoks5soSeUgaJpZM4N8RWT>.
|
The root cause is a deprecated event listener in |
+1 @mottykohn your PR works for me. Now waiting for 1.0.16 😄 |
@mottykohn the PR works for me as well till the token expires. The token does not get renewed for some reason. Has any body faced this? |
@sayush Looked over code and cannot figure out why this would happen. Never faced this. |
@mottykohn sorry, it was nothing to do with the library. Everything to do with my code. I was accidentally sending a wrong url (eg. blah.blah/home instead of blah.blah) while trying to renew the token. It wasn't giving me any detailed error message so took a while to figure out. Thanks for the prompt response. |
@mottykohn Thank you for the pull request. I merged your changes and added the definition for transition events on top of it. @mathilde-pellerin @sayush @rdkleine @gfsarri @AmitOlkar The library should now work with ui router >1.0. |
I spent few hours to try to have ADAL working with my app but even though my configuration seems to be good, the redirection to the authentication page is never triggered.
So I took a look into adal-angular.js and I found that it relies on events which are not triggered by ui-router release 1:
UI-router release 1 use transition hooks now. That would be great to have a version of adal-angular.js compatible with UI-router 1 now it has been released.
The text was updated successfully, but these errors were encountered: