Skip to content
This repository has been archived by the owner on Jun 26, 2021. It is now read-only.

expired idToken + navigation issues 2 renew commands #76

Closed
mover5 opened this issue Jan 26, 2015 · 2 comments
Closed

expired idToken + navigation issues 2 renew commands #76

mover5 opened this issue Jan 26, 2015 · 2 comments
Assignees
Labels
Milestone

Comments

@mover5
Copy link

mover5 commented Jan 26, 2015

Description:
If a user is logged in, but the idToken is expired, then they navigate to a page with requireADLogin, 2 refresh operations are issued: one in an iFrame and another via a main page redirect.

in $locationChangeStart, if the location is not a callback, it updates the auth cache. If the idToken is expired, getCachedToken will return null. This causes the else clause in the event to trigger. when acquireToken is called, the idToken will start being refreshed via an iFrame.

Then the $routeChangeStart event triggers. At this point, authData.isAuthenticated is false due to the cache refresh in locationChangeStart. If the page they are navigating to has requireADLogin, it will call adal.login(), trying to log the user in on the main page as well.

I believe if an iFrame refresh is happening, the main page should not redirect.

Changing this:
if (!_oauthData.isAuthenticated) {

To:
if (!_oauthData.isAuthenticated && !_adal._renewActive) {

in the routeChangeHandler in adal-angular.js should resolve this issue.

@omercs
Copy link
Contributor

omercs commented Jan 27, 2015

I will try that to see the issue.

@tushargupta51
Copy link
Contributor

Added _renewActive variable and if it is set, another login request is not sent.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants