Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

silent refresh navigates away from current page. #4

Open
JFelton opened this issue Aug 6, 2018 · 0 comments
Open

silent refresh navigates away from current page. #4

JFelton opened this issue Aug 6, 2018 · 0 comments

Comments

@JFelton
Copy link

JFelton commented Aug 6, 2018

In the auto login / silent renew example of this repository: https://github.com/damienbod/dotnet-template-angular/blob/master/dotnet-angular-azure-ad-oidc/ClientApp/src/app/app.component.ts

Use case:

  • auto login for default route is invoked
  • user redirects to a different secured page after authentication
  • five minutes pass
  • silent-refresh is invoked
  • this.router.navigate([path]); redirects to the default route, leaving the current page.

Debug findings:

  • onOidcModuleSetup() is only invoked during the initial auto-login use case.
  • local storage 'redirect' only contains the initial, default route
  • silent-refresh does not invoke onOidcModuleSetup() to re-write to the 'redirect' key.
  • onAuthorizationResultComplete() is invoked after silent-refresh completes
  • this.router.navigate([path]); redirects to the original stored route which is not the current route.

My fix:

  • since navigating to the current route is ultimately ignored by the angular router code, remove the local storage of 'redirect' and redirect to unauthorized only if the result is not AuthorizationResult.authorized.

console.log quick fix:
onOidcModuleSetup() has console.log('AppComponent:onModuleSetup'); included in the else block. Might help if moved outside of the if block.

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

No branches or pull requests

1 participant