Unable to log two different users in simultaneously in different browser tabs


I am experiencing the following problem, which I think is because of Keycloak SSO:

  • User 1 logs in to Realm 1: succeeds
  • Leaving the tab for User 1’s login open, open a new tab and try to log User 2 in to Realm 1: This fails, and in the logs we see a LOGIN_ERROR Keycloak event, with “error=different_user_authenticated”. In the browser, the error message displayed on the login page is “You are already authenticated as different user
    [User 1] in this session. Please logout first.”

We would like to be able to have multiple users logged in at once, in different browser tabs. Is there a good way to achieve this? I have tried this solution, but it did not work: https://stackoverflow.com/a/53279958

I have also read online that this could possibly be achieved in a custom authenticator SPI for Keycloak, but I have not had any luck with that approach either. Any advice (or code sample, if anyone has done this in SPI custom authenticator code before) would be much appreciated.