What would be a good practice for updating Tokens to avoid a 401 return

Asked

Viewed 20 times

0

Guys, I have a problem where the token ends up expiring at the time of a request POST. I currently update the token on expiry of the token:

keycloak.onTokenExpired = async () => {
    await keycloak.updateToken(TOKEN_REFRESH);   
};

However when I get the return of the new token I already have a return 401 API. What would be the best ways to address this problem? So far all the solutions I’ve thought and seen don’t look good.

  • I believe it is only possible to update a token when it is valid, after that only generating another,

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.