I have an angular 5 application in which I have implemented angular2-oauth-oidc with okta.
I am getting 400 Bad Request error saying Invalid_token when I tried to logout. It seems the session has been expired.
On clicking logout button the code used to logout is as follows:
this.oauthService.logOut();
My app.component.ts file:
this.oauthService.redirectUri = window.location.origin;
this.oauthService.clientId = oktaClientId;
this.oauthService.scope = 'openid profile email';
this.oauthService.issuer = 'https://aaaa.oktapreview.com';
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
this.oauthService.setupAutomaticSilentRefresh();
// Load Discovery Document and then try to login the user
this.oauthService.loadDiscoveryDocument().then(() => {
this.oauthService.tryLogin({
onTokenReceived: (info) => {
this.router.navigate([info.state]);
}
});
Please help to handle logout, once the session has been expired. thanks in advance.