title: Keycloak infinite sso/login loop after logged in another application
body: <p>I have a GWT application with a public and a private area which I want to connect to Keycloak 3.4</p>
  
  <p>But one scenario is not working. If logging in to another application of the same realm and afterwards opening a new browser tab with <a href="http://localhost:8080/AppName/" rel="nofollow noreferrer">http://localhost:8080/AppName/</a> the application opens with the public area. This is fine.
  Afterwards I click on the login button in the application linking to <a href="http://localhost:8080/AppName/sso/login" rel="nofollow noreferrer">http://localhost:8080/AppName/sso/login</a></p>
  
  <p>Now the problem occurs, an infinite loop of the following two urls (with different state param) starts:</p>
  
  <p><a href="http://localhost:8280/auth/realms/realmName/protocol/openid-connect/auth?response_type=code&amp;client_id=AppName&amp;redirect_uri=http%3A%2F%2Flocalhost%3A8080%2FAppName%2Fsso%2Flogin&amp;state=e7546fb4-dd04-4349-8b7d-2d84c6781d97&amp;login=true&amp;scope=openid" rel="nofollow noreferrer">http://localhost:8280/auth/realms/realmName/protocol/openid-connect/auth?response_type=code&amp;client_id=AppName&amp;redirect_uri=http%3A%2F%2Flocalhost%3A8080%2FAppName%2Fsso%2Flogin&amp;state=e7546fb4-dd04-4349-8b7d-2d84c6781d97&amp;login=true&amp;scope=openid</a></p>
  
  <p><a href="http://localhost:8080/AppName/sso/login#state=e7546fb4-dd04-4349-8b7d-2d84c6781d97&amp;code=uss.AOpenWEowTeb8VPVnJ7c8ndCEE-a9N90WZdOOP1t448.19896787-621d-4a4f-ac99-a2f4fd108deb.04c20f46-b52c-42d3-8e99-447e1b8ee5f4" rel="nofollow noreferrer">http://localhost:8080/AppName/sso/login#state=e7546fb4-dd04-4349-8b7d-2d84c6781d97&amp;code=uss.AOpenWEowTeb8VPVnJ7c8ndCEE-a9N90WZdOOP1t448.19896787-621d-4a4f-ac99-a2f4fd108deb.04c20f46-b52c-42d3-8e99-447e1b8ee5f4</a></p>
  
  <p>This happens locally, so there is no proxy. And it is independent of the browser.
  In keycloak there is a session created for the <em>AppName</em> client, so the problem seems to be in the client code.</p>
  
  <p>When calling the url <a href="http://localhost:8080/AppName/sso/login" rel="nofollow noreferrer">http://localhost:8080/AppName/sso/login</a> directly in the new tab without opening the application before with <a href="http://localhost:8080/AppName/" rel="nofollow noreferrer">http://localhost:8080/AppName/</a>, there is no problem and I am directly logged in.</p>
  
  <p>As Keycloak adapter I am using this library in the application: <a href="https://github.com/realityforge/gwt-keycloak" rel="nofollow noreferrer">https://github.com/realityforge/gwt-keycloak</a></p>
  
  <p>I am working on that problem for days, would appreciate your help! Thanks in advance ...</p>
  
  <p>Tim</p>