0

enter image description hereIn the middle of my application I am getting "Token has expired" issue, please help me how to subscribe token expire method and logout the application or else increase the expiry time. Please find below error screenshot for your reference. Thank you in advance.

Shantanu
  • 11
  • 1
  • 3

1 Answers1

3

You need to refresh your token before it expires. Check out the documentation here (if you're using Code Flow) or here (if you're using implicit flow)

In your app.component.ts file you could also try to subscribe to the "token_expires" event after configuring your oAuthService (after calling this.oauthService.loadDiscoveryDocumentAndTryLogin();)

this
    .oauthService
    .events
    .filter(e => e.type == 'token_expires')
    .subscribe(e => {
        this.oauthService.silentRefresh();
    });
Boommeister
  • 1,591
  • 2
  • 15
  • 54