We have implemented a vaadin application using latest 14 LTS version of Vaadin and integrated with Keycloak 8. The configuration works and when we first start the application the user is forwarded to keycloak login page and then redirected to vaadin app.
When keycloak token expires, the application doesn’t redirect to keycloak as it runs in background a heartbeat ajax request and tries to redirect to keycloak login page. We first getting a CORS error from keycloak which some how can be resolved from Keycloak I assume, but even though this work, the redirect doesn’t redirect us to keycloak login, as it is ajax request
When we inspect the page we have this flow:
Heartbeat URL URL: http://localhost:8090/?v-r=uidl&v-uiId=3
Application Login Page URL: http://localhost:8090/sso/login
Example Code
https://github.com/karkaletsis/vaadin-keycloak
It is a simple app containing a page with a button which just adds a Notification.
Way to reproduce
- Access: http://localhost:8090
- Redirect to keycloak
- Login
- Redirect to http://localhost:8090
- Click once the button
- Wait for 1 minute
- Click the button and you will see this “Connectio lost error”
I am using Vaadin 16 LTS and keycloak 4.8.3 (same error with Keycloak 8 also). Configure keycloak token to expire in one minute to see this behaviour
Keycloak Login URL URL: https://keycloak_url/auth/realms/htp/protocol/openid-connect/auth?response_type=code&client_id=web&redirect_uri=http%3A%2F%2Flocalhost%3A8090%2Fsso%2Flogin&state=6ed652f2-dd7e-4398-bc60-798f6d055f69&login=true&scope=openid due to access
and the result is a not a json response in a window in application having the keycloak login form instead of redirecting
Any idea how to solve this issue?