<div dir="ltr">Solved! I also need to change the fromUrl(&#39;&#39;) to fromUrl(&quot;localhost:8180/auth&quot;), instead of the relative url. <div><br></div><div>Thanks. for all.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 3, 2016 at 4:39 PM, Martin Min <span dir="ltr">&lt;<a href="mailto:lingvisa@gmail.com" target="_blank">lingvisa@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, Marek, I changed it to this in view.jsp:<div><br></div><div><span class=""><div><font color="#1155cc"><u> String logoutUri = KeycloakUriBuilder.fromUri(&quot;/auth&quot;).path(ServiceUrlConstants.TOKEN_SERVICE_LOGOUT_PATH)</u></font></div></span><div><font color="#1155cc"><u>            .queryParam(&quot;redirect_uri&quot;, &quot;<b><a href="http://localhost:8080" target="_blank">http://localhost:8080</a></b>/customer-portal&quot;).build(&quot;demo&quot;).toString();</u></font></div><div><br></div><div><br></div><div>But now when I click the &quot;logout&quot; link, I got this error:</div><div><br></div><div><div><a href="http://localhost:8080/auth/realms/demo/protocol/openid-connect/logout?redirect_uri" target="_blank">http://localhost:8080/auth/realms/demo/protocol/openid-connect/logout?redirect_uri</a><b>=http</b>%3A%2F%2Flocalhost%3A8080%2Fcustomer-portal<br></div><div><br></div><div>which is slightly different from the earlier error message when I used the relative url parameter &quot;/customer-portal&quot;, as below:</div><div><br></div><div><a href="http://localhost:8080/auth/realms/demo/protocol/openid-connect/logout?redirect_uri=%2Fcustomer-portal" style="font-size:12.8px" target="_blank">http://localhost:8080/auth/realms/demo/protocol/openid-connect/logout?redirect_uri<b>=</b>%2Fcustomer-portal</a><br></div><div><br></div><div><br></div><div>So just change the &#39;queryParam(,)&#39; doesn&#39;t solve the problem.  Please see my configuration of URLs.</div><div><br></div><div>What needs to be done additionally? </div><div><br></div></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 1, 2016 at 10:14 AM, Marek Posolda <span dir="ltr">&lt;<a href="mailto:mposolda@redhat.com" target="_blank">mposolda@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>You also need to change the
      redirect_uri query param to be absolute URL instead of relative
      URL. As you can see, the value &quot;/customer-portal&quot; is just relative
      URL, so it won&#39;t work with 2 separate servers.<br>
      <br>
      Marek<div><div><br>
      <br>
      On 31/07/16 22:48, Martin Min wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div>
      <div dir="ltr">After I changed the relative url &quot;/customer-portal&quot;
        to its full url, &quot;<a href="http://localhost:8080/customer-portal" target="_blank">http://localhost:8080/customer-portal</a>&quot;,
        the customer listing and product listing functionality works
        correctly. 
        <div><br>
        </div>
        <div>However, the remaining problem is, when I click the &quot;log
          out&quot; link, I received this error:</div>
        <div><br>
        </div>
        <div><a href="http://localhost:8080/auth/realms/demo/protocol/openid-connect/logout?redirect_uri=%2Fcustomer-portal" target="_blank">http://localhost:8080/auth/realms/demo/protocol/openid-connect/logout?redirect_uri=%2Fcustomer-portal</a><br>
        </div>
        <div><br>
        </div>
        <div>In view.jsp, the logout code is this:</div>
        <div><br>
        </div>
        <div>
          <div> String logoutUri =
KeycloakUriBuilder.fromUri(&quot;/auth&quot;).path(ServiceUrlConstants.TOKEN_SERVICE_LOGOUT_PATH)</div>
          <div>            .queryParam(&quot;redirect_uri&quot;,
            &quot;/customer-portal&quot;).build(&quot;demo&quot;).toString();</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>What could cause this error message? </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Sat, Jul 30, 2016 at 4:58 PM, Martin
          Min <span dir="ltr">&lt;<a href="mailto:lingvisa@gmail.com" target="_blank">lingvisa@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">PLEASE: the title of my email above should be
              renamed to &quot; <span style="font-size:17.6px">Failed to run
                the Customer-portal Demo on two separate servers,
                KeyCloak 2.0 and Wildfly 10.0</span>&quot;. Not on two
              machines, but two severs on the same machine. Sorry for
              the correction.</div>
            <div>
              <div>
                <div class="gmail_extra"><br>
                  <div class="gmail_quote">On Sat, Jul 30, 2016 at 4:57
                    PM, Martin Min <span dir="ltr">&lt;<a href="mailto:lingvisa@gmail.com" target="_blank"></a><a href="mailto:lingvisa@gmail.com" target="_blank">lingvisa@gmail.com</a>&gt;</span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div dir="ltr">Hi, I can run the preconfigured
                        Customer-portal demo successfully on the single
                        keycloak-demo-2.0.0.Final distribution by
                        importing the testrealm.json file to create the
                        realm. Everything works fine. 
                        <div><br>
                        </div>
                        <div>And also I can run this simple login/logout
                          demo by following this instruction to install
                          and setup KeyCloak and Wildfly servers
                          separately: </div>
                        <div><br>
                        </div>
                        <div><a href="https://keycloak.gitbooks.io/getting-started-tutorials/content/v/2.0/topics/overview.html" target="_blank">https://keycloak.gitbooks.io/getting-started-tutorials/content/v/2.0/topics/overview.html</a>
                          <div><br>
                          </div>
                          <div><br>
                          </div>
                          <div>However, I failed to run the
                            Customer-Portal demo by trying to set up the
                            KeyClaok server and Wildfly server
                            separately. It always gives me this message
                            as I clicked the &quot;<a href="http://localhost:8080/customer-portal/customers/view.jsp" target="_blank">Customer Listing</a>&quot;
                            link:</div>
                        </div>
                        <div><br>
                        </div>
                        <div><a href="http://localhost:8080/auth/realms/demo/protocol/openid-connect/auth?response_type=code&amp;client_id=customer-portal&amp;redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fcustomer-portal%2Fcustomers%2Fview.jsp&amp;state=2%2Fe8f347bf-dd8c-4c48-a060-0b01d33476db&amp;login=true" target="_blank">http://localhost:8080/auth/realms/demo/protocol/openid-connect/auth?response_type=code&amp;client_id=customer-portal&amp;redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fcustomer-portal%2Fcustomers%2Fview.jsp&amp;state=2%2Fe8f347bf-dd8c-4c48-a060-0b01d33476db&amp;login=true</a><br>
                        </div>
                        <div><br>
                        </div>
                        <div>I did exactly the same thing as I tested in
                          the KeyCloak-demo distribution by importing
                          the testrealm.json.</div>
                        <div><br>
                        </div>
                        <div>I didn&#39;t configure the subsystem section in
                          the Wildfly 10&#39;s standalone.xml, since I
                          believe the &quot;keycloak.json&quot; and &quot;web.xml&quot; in
                          the application&#39;s WEB-INF directory will do
                          the same thing.  I only had this configured in
                          Wildfly standalone.xml:</div>
                        <div><br>
                        </div>
                        <div>
                          <div>&lt;security-domain name=&quot;keycloak&quot;&gt;</div>
                          <div>                   
                            &lt;authentication&gt;</div>
                          <div>                        &lt;login-module
                            code=&quot;org.keycloak.adapters.jboss.KeycloakLoginModule&quot;
                            flag=&quot;required&quot;/&gt;</div>
                          <div>                   
                            &lt;/authentication&gt;</div>
                          <div>                &lt;/security-domain&gt;</div>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div>What am I missing? Thank you for your help
                          to this working. By the way, it would be
                          really great to have a full tutorial on how to
                          set up the customer-portal demo  on two
                          separate KeyCloak and Wildfly servers by
                          configuring both Json and subsystem file. </div>
                        <div><br>
                        </div>
                        <div>Thank you for help.</div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
keycloak-user mailing list
<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br></div>
</div></div></blockquote></div><br></div>