Flow logout

What would be the best way to logout in Flow? In V8 I did a close on the UI and did a sendRedirect on the response to the context root and an ViewChangeListener kicked you to the login page when it noticed you weren’t logged in. In Flow I get nothing until clicking something again or then some JSON response error

Recommended logout procedure is quite similar to what it was in V8.

VaadinSession.getCurrent().getSession().invalidate();
UI.getCurrent().getPage().executeJavaScript("window.location.href=''");

(setLocation method is not yet in Page, see: https://github.com/vaadin/flow/issues/4869 )

One (but not the only) way to use this is to e.g. to implement LogoutView with logout Route which implements BeforeEnterObserver and then have the above in beforeEnter(…) method.

Thanks, that did the trick. Although it also the killed the login in a separate tab, even if I just used UI.close (I thought the tab had a separate instance?). What would be the single-UI-logout-approach?