How to handle access token expiration in angular application that uses oidc code flow?
I set the automaticSilentRenew to true in oidc client settings, which is triggering a call to the token endpoint and getting new access token, then I listen to the addAccessTokenExpiring event and set the new user information.
Is there a different way for handling expired tokens when using authorization code flow? can't get this to work properly!
//Note: this.user object contains the access token that I use when I request a protected api
this.mgr.events.addAccessTokenExpiring(() => {
console.log("token expiring...");
this.mgr.getUser().then(user => {
this.user = user;
});
});
I expect that the http request I made to the protected api will be using the new access token but it ends up using the expired one and receiving 401 on the client side...