Reputation: 81
I'm working on a project with the latest Keycloak version, Spring Boot and Spring Oauth2 and Angular as the frontend layer.
Here is my keycloak token configuration:
Whatever value I set for property "SSO Session Idle" on my kecloak server, I end up with a RFRESH_TOKEN_ERROR after 30 minutes (That is the default value for this property based on the official documentation) and after that I can't call any backend endpoint anymore, my token has been invalidated and all calls are made with an Anonymous Authentication object.
What should I do to make this property work (In my case it shouldn't invalidate the token before 10 hours) ? Do I have somehow to refresh the token from frontend side to avoid my token being invalidated ? How should I handle the client inactivity timeout so as users don't have to log in again every 30 minutes ?
Any help or example would be highly appreciated.
Advanced settings for the client on keycloak server: client settings
Upvotes: 7
Views: 13612
Reputation: 804
I faced the same issue from Client Side. After Refreshing Tokens in Client Side I was able to solve the issue. I used the following code. This could help. Kindly check.
keycloak.onTokenExpired = () => {
console.log(">>> Re-Authenticated");
keycloak.updateToken(50);
};
Upvotes: 0