<div dir="ltr">You don&#39;t need to pass in the whole keycloak.json like this, to initialize it without the request for keycloak.json just do:<div><br></div><div>  new Keycloak({</div><div>    realm: &quot;myReam&quot;,</div><div>    clientId: &quot;myClientId&quot;</div><div>  }</div><div><br></div><div>That&#39;s it.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 14 April 2016 at 21:59, Michael Clayton <span dir="ltr">&lt;<a href="mailto:mclayton@redhat.com" target="_blank">mclayton@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">Hi all,<br>
<br>
I&#39;m integrating keycloak.js with the Red Hat Customer Portal and have a<br>
question about passing a configuration object into the Keycloak()<br>
constructor.<br>
<br>
At the point where I call Keycloak(), I&#39;m attempting to avoid waiting<br>
for the keycloak.json HTTP GET by inlining keycloak.json during a build<br>
step.  By example, my build now produces this:<br>
<br>
    var keycloak = new Keycloak({<br>
        &quot;realm&quot; : &quot;myRealm&quot;,<br>
        &quot;realm-public-key&quot; : &quot;myPublicKey&quot;,<br>
        &quot;auth-server-url&quot; : &quot;<a href="https://keycloak.me/auth" rel="noreferrer" target="_blank">https://keycloak.me/auth</a>&quot;,<br>
        &quot;ssl-required&quot; : &quot;external&quot;,<br>
        &quot;resource&quot; : &quot;myClientId&quot;,<br>
        &quot;public-client&quot; : true,<br>
        &quot;token-store&quot;: &quot;cookie&quot;<br>
    });<br>
<br>
I was hoping this would Just Work, but I quickly discovered that some of<br>
the properties are &quot;renamed&quot; after the HTTP request:<br>
<br>
    kc.authServerUrl = config[&#39;auth-server-url&#39;];<br>
    kc.realm = config[&#39;realm&#39;];<br>
    kc.clientId = config[&#39;resource&#39;];<br>
    kc.clientSecret = (config[&#39;credentials&#39;] || {})[&#39;secret&#39;];<br>
<br>
And thus my setup doesn&#39;t work because &quot;clientId&quot; doesn&#39;t exist inside<br>
keycloak.json.<br>
<br>
My question is: would I be foolish to rename the properties inside<br>
keycloak.json so that the JSON can be passed directly into the Keycloak<br>
constructor?  For example, &quot;resource&quot; becomes &quot;clientId&quot; and<br>
&quot;auth-server-url&quot; becomes &quot;authServerUrl&quot;.<br>
<br>
It would be really convenient if I could give keycloak.js the contents<br>
of keycloak.json without having to fret about where it came from (AJAX<br>
or hardcoded or build-inlined).  If others would like that feature too,<br>
I&#39;d happily put together a contribution.<br>
<br>
Thanks for any advice!<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Michael Clayton<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><br>
</font></span></blockquote></div><br></div>