<p>I have a Keycloak server hosted in Kubernetes. When I request to external identity provider (like Google/Facebook), the hostname was used in the redirect url automatically. How can I change the redirect URL for my identity provider?</p>

<p>The auto generated redirect_url from Keycloak:
<code>http://keyclaok:8080/auth/realms/{MY_REALM}/borker/google/endpoint</code></p>

<p>What I'm expected: 
<code>http://www.example.com/my-custom-callback/endpoint</code>, this url will redirect to the original keyclaok endpoint. </p>

<p><a href="https://i.stack.imgur.com/vvA9j.png" rel="nofollow noreferrer">My identity provider settings in Keycloak</a></p>

Kelvin Lee
<p>The auto_generated redirect_url (shown in the UI) should not be relevant for you.</p>

<p>Afaik keycloak just build up the url with the current hostname you are accessing keycloak.
So when you access your admin console via</p>

<pre><code>http://keyclaok:8080/
</code></pre>

<p>Redirect URL for a google Identity Provider is shown as</p>

<pre><code>http://keyclaok:8080/auth/realms/{MY_REALM}/broker/google/endpoint
</code></pre>

<p>If you access keycloak over your domain</p>

<pre><code>http://www.example.com/auth
</code></pre>

<p>and try to authenticate over google, the valid redirect URL will be</p>

<pre><code>http://www.example.com/auth/realms/{MY_REALM}/broker/google/endpoint
</code></pre>

<p>In my opinion you can't decide how the redirect url will look like (especially not the suffix <code>realms/{MY_REALM}/broker/google/endpoint</code>), because it's relative to the keycloak base URL and keycloak needs it internally to map a answer to the correct realm and IDP
But I think you shouldn't have a problem with such a url, as long as keycloak is accessible over your domain</p>
