<div dir="ltr">You can use &#39;*&#39; to make it valid for all redirect URIs. Make sure you don&#39;t do that in production though. Especially if you are using public clients (html5 apps, etc..), in those cases the redirect uri is the main safe guard that prevents malicious applications logging in.</div><div class="gmail_extra"><br><div class="gmail_quote">On 23 November 2015 at 21:26, Håvard Wigtil <span dir="ltr">&lt;<a href="mailto:haavard.wigtil@kantega.no" target="_blank">haavard.wigtil@kantega.no</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I&#39;m not sure that I&#39;m asking the right question yet, so I&#39;ll try again.<br>
<br>
We have Keycloak installed on keycloak.my.lan. We&#39;re running development<br>
on several developer PCs, which we access by their public IP because we<br>
test on several devices against our local development environment. So my<br>
application is hosted on 192.168.1.2 at the moment, my colleague is<br>
running her version of the same application at 192.168.1.4, and our IPs<br>
may change the next day.<br>
<br>
If I configure the client &quot;myclient&quot; in the &quot;Clients&quot; section in<br>
Keycloak admin console with a &quot;Valid redirect URI&quot; of<br>
&quot;<a href="http://192.168.1.2:3000/app/login" rel="noreferrer" target="_blank">http://192.168.1.2:3000/app/login</a>&quot; then login works. If I change this<br>
to only &quot;/app/login&quot; then I am presented with the error &quot;We&#39;re sorry...<br>
Invalid parameter: redirect_uri&quot; from Keycloak before I get a chance to<br>
enter my credentials.<br>
<br>
The URL from my application in both cases is the URL below, so the<br>
redirect URI as sent from the application is always absolute:<br>
<a href="https://keycloak.my.lan/auth/realms/myrealm/protocol/openid-connect/auth?client_id=myclient&amp;redirect_uri=http%3A%2F%2F192.168.1.2:3000%2Fapp%2Flogin&amp;state=3525097d-e0f8-4013-890f-08fba8439412&amp;response_type=code" rel="noreferrer" target="_blank">https://keycloak.my.lan/auth/realms/myrealm/protocol/openid-connect/auth?client_id=myclient&amp;redirect_uri=http%3A%2F%2F192.168.1.2:3000%2Fapp%2Flogin&amp;state=3525097d-e0f8-4013-890f-08fba8439412&amp;response_type=code</a><br>
<br>
I left out the last relevant part of the help message (for brevity) in<br>
my first mail. In addition to &quot;Relative path can be specified too, i.e.<br>
/my/relative/path/*&quot; it also says &quot;Relative paths will generate a<br>
redirect URI using the request&#39;s host and port&quot;. My reading of those two<br>
sentences together lead me to believe that I could leave out the<br>
<br>
So my real question is: Is it possible to set a single &quot;Valid redirect<br>
URI&quot; in Keycloak console for my app that will work when the app is<br>
served from either <a href="http://192.168.1.2/app" rel="noreferrer" target="_blank">http://192.168.1.2/app</a> or <a href="http://192.168.1.4/app" rel="noreferrer" target="_blank">http://192.168.1.4/app</a> and<br>
possibly many similar URIs? Or do I have to specify every possible URI<br>
that my app could be served from under &quot;Valid redirect URIs&quot;?<br>
<br>
   Håvard<br>
<div class="HOEnZb"><div class="h5"><br>
Den 23. nov. 2015 20:19, skrev Bill Burke:<br>
&gt; A relative URI *will not* be accepted if it is passed as a query<br>
&gt; parameter when a client is requesting a code.  An absolute URI *MUST BE*<br>
&gt; sent via the redirect_uri query parameter.  For admin console config, if<br>
&gt; you put in relative path in your valid redirect URIs, it uses the<br>
&gt; host/port of the auth server.  A bunch of the demos work that way.  So,<br>
&gt; if you host the auth server on <a href="http://mydomain.com" rel="noreferrer" target="_blank">mydomain.com</a>,<br>
&gt; <a href="https://localhost/my/relative/path" rel="noreferrer" target="_blank">https://localhost/my/relative/path</a> will match and<br>
&gt; <a href="https://mydomain.com/my/relative/path" rel="noreferrer" target="_blank">https://mydomain.com/my/relative/path</a> will work too.  Make sense?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On 11/23/2015 2:00 PM, Håvard Wigtil wrote:<br>
&gt;&gt; I&#39;m trying to get a relative (i.e. path only with no host) redirect URI<br>
&gt;&gt; for a Keycloak client to work. My client works with full host and path,<br>
&gt;&gt; but if I remove the host part I get an illegal parameter error.<br>
&gt;&gt;<br>
&gt;&gt; The inline help bubble has the following sentence: &quot;Relative path can be<br>
&gt;&gt; specified too, i.e. /my/relative/path/*.&quot;<br>
&gt;&gt; So as far as I can tell, it should work according to the help message.<br>
&gt;&gt; As I was trying to find out more about this I came across Jira issue<br>
&gt;&gt; KEYCLOAK-8[1], where a comment pointed to section 3.2.1[2] of the OAuth<br>
&gt;&gt; 2.0 spec. If I&#39;m reading the spec correctly the redirect *must* be<br>
&gt;&gt; absolute to be conformant with the spec.<br>
&gt;&gt;<br>
&gt;&gt; Is the inline help wrong, or is it something here that I don&#39;t get?<br>
&gt;&gt;<br>
&gt;&gt;      Håvard<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; [1] <a href="https://issues.jboss.org/browse/KEYCLOAK-8" rel="noreferrer" target="_blank">https://issues.jboss.org/browse/KEYCLOAK-8</a><br>
&gt;&gt; [2] <a href="https://tools.ietf.org/html/rfc6749#section-3.1.2" rel="noreferrer" target="_blank">https://tools.ietf.org/html/rfc6749#section-3.1.2</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; keycloak-user mailing list<br>
&gt;&gt; <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
&gt;&gt;<br>
<br>
--<br>
</div></div><span class="HOEnZb"><font color="#888888">Håvard Wigtil<br>
arkitekt og utvikler, Kantega AS<br>
tlf. <a href="tel:%2B47%209384%206468" value="+4793846468">+47 9384 6468</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></div></div></blockquote></div><br></div>