-
Notifications
You must be signed in to change notification settings - Fork 371
Digest iterations infinite loop in HTML5 mode #42
Comments
Did you try to add $locationProvider.hashPrefix('!'); |
Unfortunately the hashprefix doesn't fix the issue, I've just given it a go. |
Can we get an update on this? it seems to interfere with the token renewal portions of ADAL as well, so it's next to impossible to get a token for, say, AD graph. A workaround or ETA would be swell. |
Angular is triggering endless redirects if you specify your default route to be "/". Related angular issue: angular/angular.js#1417 In your app, you can fix this issue with using a name for default route. Following change works for your app(https://github.com/ruddles/ADALIssue ) $routeProvider
.when('/home', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/about', {
templateUrl: 'views/about.html',
controller: 'AboutCtrl'
}).
otherwise({ redirectTo: '/home' });
; instead of using "/" as default path. |
also note, today getting a token for the graph not have much use given that the graph does not support CORS. I believe it is in their roadmap, but they did not share times. |
I experimented with some of the suggested solutions, and wasn't seeing success. Relatively speaking, I'm an angular newbie and had an existing project dropped on me. However, I did spend some time debugging and found the culprit: |
@brphelps : what is the main page address? Is default path "/"? |
I will close this. If you repro after following the suggestions, please open again. |
Any chance this issue could be revisited? It looks like there are some strong assumptions about how routing is done to fix, it would be nicer to just have a real fix that didn't involve ng-route specific stuff. |
@omercs I've experienced this same issue. |
@omercs same issue for me, thus the '.otherwise' workaround worked. Thanks. |
I am still experiencing a similar issue. Any guidance on how to resolve this would be very helpful. The mitigation steps mentioned above to use a named default route have no impact on the issue. |
The problem still exists in html5Mode when adal tries to get the tokens for the first time. All methods in my constructors are excuted 10 times because of the infinite digest loop. You can reproduce the issue if you clear all adal stuff from localStorage and load the page
|
Y'all should open this issue back up for awareness, given that it's a work item for someone now. |
Any fix is available for this? |
@venkateshappala Don't rely on it... look at when this issue was opened. |
We did something like this to address the issue:
We've also added similar checks for id_token and access_token in our $urlRouterProvider.otherwise function |
I am having this issue too. Cannot solve it. Tried LOTS of different things. I am using ui-router. cheers |
Was this solved with this PR? It is currently merged to dev. 60b6639 |
@tushargupta51 userInfo.profile.nonce: 2cce876e-fc24-4afc-9acf-0b5fa2cda89b I will provide those two after the loop starts as well. So thats the two nonce's adal checks that are equal? And if not, the adal.login.error gets set in the session storage? No, I'm not using an .otherwise route for now, just to exclude that. This is my setup: $stateProvider |
Because of the endless loop, the developer tools refreshes so I cant get too the userinfo object to see the nonce value. |
@jonfreberg You can check "preserve log" in the Chrome console and console.log(userinfo) from your code. |
I have the same issue. I have basically the simplest possible Angular/ADAL app with no routing:
|
Jumping in because I've managed to solve the "Nonce is not the same as" problem with a workaround: Looking in the DOM inspector, I can see that there are multiple ADAL renew token iframes nested. I believe what is happening is that the iFrame is renewing the token and ending up back at This new app then periodically tries to renew the token out of sync with the parent. Because they share the same context the GUIDS are overwriting in sessionstorage. I have worked around this problem by detecting if the app is inside an iframe as part of the bootstrap process, then ONLY starting up angular-adal and not loading any of my other app modules. It seems to solve the infinite looping problem. HOWEVER: this does not solve the infdig issue on a brand new instance of the app which happens consistently unless I comment out
oddly, if I set the token store to localstorage, this also fixes it, but I don't want to use localStorage for security reasons. |
Thanks for the reply @adamauckland ! Could you give a little more details on how you only start up angular-adal if the app is inside an iFrame in the bootstrap process? |
Yep, @jonfreberg. It's really not anything clever. Conceptually, we just create the primary module differently depending on if we're the top frame or not like this:
Obviously the actual implementation has a bit more checking around it, but that's the principle. |
Thanks @adamauckland . I'll give it a go. My versions: I've updated all my packages now, so I'm at this moment testing with versions: |
Angular 1.4.7 |
Can someone put an example together that works? Since I am having big trouble with these bugs |
We have Pull Requests submitted that will address the issues mentioned here:
These PRs will be merged soon. I will the close the issue then. If you still run into this issue, let us know, we can re-visit this. |
I have tried all the work arounds suggested here and nothing is working. Can someone put together a sample app that works? It will help me and new comers to the problem as well. |
Hi, I'm also having same issues here I already try all the possible sugestions that I found and nothing works. Someone was able to male this work fine, that can give me some hints to see if I can make it work. thanks! |
Yes I try it out it is giving me the same error, this is if I run it on IE [image: Inline image 1] On Wed, Jul 13, 2016 at 12:31 PM, tushar gupta notifications@github.com
|
We have released 1.0.11 with fixes to some of the digest iterations issue. Please use 1.0.11 and have a look here if you are still running into this issue: https://github.com/AzureAD/azure-activedirectory-library-for-js/wiki/FAQs#q2-my-app-gets-into-an-infinite-loop-sometimes-leading-to-digest-iterations-error @jjalfaro I am closing this issue for now but feel free to open a new issue with the details: logs, traces if you still experience the loop with the new release. |
I was facing this digest iterations issue with version 1.0.0. |
Yes i have. Especially if using ui-router. A r e u using ui router?
Sent from Samsung Mobile
…-------- Original message --------
From: dgodwin1175
Date:07/04/2017 17:16 (GMT+10:00)
To: AzureAD/azure-activedirectory-library-for-js
Cc: nigel-dewar , Comment
Subject: Re: [AzureAD/azure-activedirectory-library-for-js] Digest iterations infinite loop in HTML5 mode (#42)
I was facing this digest iterations issue with version 1.0.0.
I worked around it by setting the $window.location.hash = '' as already mentioned, however this meant that my token would only renew on route changes, but I need it to renew as required.
So I decided to update to the latest version (1.0.14), but now, I'm in a different kind of infinite loop.
When launching my app, Chrome locks up and then runs out of memory. Has anyone seen this before? All I've done is swap out the two js files!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#42 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AI94WCVo5_0Zillsgc7ru8Pleif4mGXzks5rteLDgaJpZM4C9Kuw>.
|
Yes I certainly am, and I'd really prefer not to have to rip it out. Have you managed to resolve or at least find the root cause? |
Yes i have. The issue is well documented if u do a search for adal.js and ui-router.
There are a few things that need to be done, to prevent its crazy looping.
Its friday 6.40pm and i need to cook dinner (my wife is waiting), if you cant get it sorted via some searching, then i can post the code and explanation in like 1 hour from now. Sorry to keep u hanging.
Sent from Samsung Mobile
…-------- Original message --------
From: dgodwin1175
Date:07/04/2017 18:11 (GMT+10:00)
To: AzureAD/azure-activedirectory-library-for-js
Cc: nigel-dewar , Comment
Subject: Re: [AzureAD/azure-activedirectory-library-for-js] Digest iterations infinite loop in HTML5 mode (#42)
Yes I certainly am, and I'd really prefer not to have to rip it out. Have you managed to resolve or at least find the root cause?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#42 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AI94WMtKUHaYBfygvRd97HhewslgN5cyks5rte_CgaJpZM4C9Kuw>.
|
Pls post when you can. No need to do it on your Friday night! Thanks so much. |
Ok mate, managed to fire up laptop inbetween dinner. Here is what you need to do In your Angular run block you need to do this.
so if your angular run might look like this angular.module('app').run('runBlock'); function runBlock($rootScope, $location, $state) { Secondly you will need to do this In your route code, (most likely in your routeConfig class), instead of doing this $urlRouterProvider.otherwise('/'); You will need to do this $urlRouterProvider.otherwise(
Make your default route 'home' or something like that. What is happening, is ui-router does not play nice with adal.js. I have found no version of adal.js does. Give it a shot and let me know how you go! Hope it works for you mate. I have found it works ok. |
It doesn't appear to work, the browser hangs on this piece of code from angular.js, before my .otherwise() function is called: |
Hmmm. I will post a sample repo for u to try. Ul just need to swap out clientid etc foe urs.
What version of angular u using.?
Also what version of ui router?
And..... what version of adal.js?
This will help me with sample.
Sent from Samsung Mobile
…-------- Original message --------
From: dgodwin1175
Date:10/04/2017 19:22 (GMT+10:00)
To: AzureAD/azure-activedirectory-library-for-js
Cc: nigel-dewar , Comment
Subject: Re: [AzureAD/azure-activedirectory-library-for-js] Digest iterations infinite loop in HTML5 mode (#42)
It doesn't appear to work, the browser hangs on this piece of code from angular.js, before my .otherwise() function is called:
injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
function bootstrapApply(scope, element, compile, injector) {
scope.$apply(function() {
element.data('$injector', injector);
compile(element)(scope);
});
}]
);
return injector;
};
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#42 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AI94WAIxWpGBOxKUsI5phUmn9Pp-xBExks5rufTHgaJpZM4C9Kuw>.
|
I'm using angular 1.5.8 |
Cheers. Ill post sample this morn.
Sent from Samsung Mobile
…-------- Original message --------
From: dgodwin1175
Date:11/04/2017 00:52 (GMT+10:00)
To: AzureAD/azure-activedirectory-library-for-js
Cc: nigel-dewar , Comment
Subject: Re: [AzureAD/azure-activedirectory-library-for-js] Digest iterations infinite loop in HTML5 mode (#42)
I'm using angular 1.5.8
ui-router 2.18
adal.js/adal-angular 1.0.14
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#42 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AI94WJuiJIJHuqlQXnsN_IVRPYL432Yeks5rukIUgaJpZM4C9Kuw>.
|
Hi Nigel, I'm now using these. I'm tempted to try swapping out the ui-router for the angular-router. |
If I add the library to a project that uses html5mode and enter a URL with a # on the end (e.g. http://localhost:9000# or http://localhost:9000/# ) the developer console is battered with errors:
If I turn off html5mode or remove the
adalAuthenticationServiceProvider.init
call in app.js then everything is fine. I've had a quick look through but I cannot see what's causing it. I've added a sample at https://github.com/ruddles/ADALIssue which you can clone, npm install && bower install, grunt serve and then test the app by opening the developer console, and add a # to the end of the URL.I've tested this in both chrome and firefox on a mac.
The text was updated successfully, but these errors were encountered: