DEV Community

loading...

Discussion on: Secure Svelte with Keycloak

Collapse
matejbucek profile image
Matěj Bucek Author

Hi, thank you very much.
The method this.keycloak.updateToken(number) silently updates your tokens, when the refresh token is still non-expired. Otherwise it makes redirect to your Keycloak Authorization Endpoint and user have to log in.
In the latest version of my code, you can see that I've set this.keycloak.onTokenExpired to an anonymous lambda function, that calls the update method. The onTokenExpired method is called by Keycloak itself, so you don't have to worry about updating your token anymore.