Skip to content

silent refresh navigates away from current page. #4

@JFelton

Description

@JFelton

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions