<div dir="ltr"><div><div>Great! I&#39;m looking forward to see keycloak Alpha 3 release :D</div></div><div><br></div><div>Thank you guys.</div><div><br></div><div>Rodrigo. </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Mar 10, 2014 at 10:38 AM, Bill Burke <span dir="ltr">&lt;<a href="mailto:bburke@redhat.com" target="_blank">bburke@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">
I wrote some docs for it, but won&#39;t be published until Alpha 3<br>
<div class="HOEnZb"><div class="h5"><br>
On 3/10/2014 10:34 AM, Stian Thorgersen wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; We have a JS library, it&#39;s available at <a href="http://localhost:8080/js/keycloak.js" target="_blank">http://localhost:8080/js/keycloak.js</a>. There&#39;s no documentation for it yet, and the example needs a bit of TLC, but the example is customer-app-js and will be included in the alpha3 downloads that is due this week.<br>

&gt;<br>
&gt; A quick overview to get you started:<br>
&gt;<br>
&gt; Keycloak constructor takes a single object with the following properties:<br>
&gt;<br>
&gt; * client_id (required) - the name of the application/client in the admin console<br>
&gt; * client_secret (optional) - not recommended, instead select public client option for your application/client in the admin console<br>
&gt; * realm (required)<br>
&gt; * url (optional) - the base url of the server, if not specified it will infer it from the url of the keycloak.js script<br>
&gt; * onload (optional) - valid options: login-required, check-sso. Login required will redirect to login form when init is called. Check-sso will also redirect to login form, but won&#39;t display login form (used to check if user is logged into to sso realm)<br>

&gt;<br>
&gt; For example:<br>
&gt;<br>
&gt;    var keycloak = Keycloak({ client_id: &#39;myapp&#39;, realm: &#39;myrealm&#39; })<br>
&gt;    keycloak.init(function() { alert(&#39;authenticated&#39;) }, function() { alert(&#39;auth failed&#39;) } );<br>
&gt;<br>
&gt; Addition methods:<br>
&gt;<br>
&gt; * login - redirect to login form<br>
&gt; * logout - log out<br>
&gt; * hasRealmRole(role) - returns true if user has the realm role<br>
&gt; * hasResourceRole(role, resource) - return true if user has the role for the specified resource (application)<br>
&gt; * loadUserProfile(success, failure) - loads the profile (in the future profile will be retrieved with IDToken from OpenID Connect spec, so this will probably not be required)<br>
&gt; * onValidAccessToken(success, failure) - invoke methods with a valid token. If the token is expired the refresh token is used to retrieve a new token before invoking the success callback<br>
&gt;<br>
&gt; Once authenticated the following properties are available as well:<br>
&gt;<br>
&gt; * token - base64 encoded token (use this as the value for the &#39;Authorization&#39; header, for example &quot;xMLHttpRequest.setRequestHeader(&#39;Authorization&#39;, &#39;Bearer &#39; + keycloak.token)&quot;)<br>

&gt; * tokenParsed - parsed token<br>
&gt; * authenticated - true if authenticated, false otherwise<br>
&gt; * subject - userId<br>
&gt;<br>
&gt; Please let me know how you get on with it, any feedback would be appreciated.<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Stian<br>
&gt;<br>
&gt;<br>
&gt; ----- Original Message -----<br>
&gt;&gt; From: &quot;Rodrigo Del Canto&quot; &lt;<a href="mailto:delkant@gmail.com">delkant@gmail.com</a>&gt;<br>
&gt;&gt; To: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
&gt;&gt; Sent: Saturday, 8 March, 2014 5:54:44 AM<br>
&gt;&gt; Subject: [keycloak-user] External JS AJAX client for jax-rs backend API<br>
&gt;&gt;<br>
&gt;&gt; Hello guys,<br>
&gt;&gt;<br>
&gt;&gt; Congrats on the release of project! I think this is the most useful project<br>
&gt;&gt; for developers in the whole history of internet :D<br>
&gt;&gt;<br>
&gt;&gt; I would like to know if you have any example on how to perform a login from<br>
&gt;&gt; an external JavaScript client?<br>
&gt;&gt;<br>
&gt;&gt; How would you recommend to do this. I heard you have a JS/jQuery lib to do<br>
&gt;&gt; this, where can it be found?<br>
&gt;&gt;<br>
&gt;&gt; Thanks,<br>
&gt;&gt;<br>
&gt;&gt; delkant<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" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
&gt; _______________________________________________<br>
&gt; keycloak-user mailing list<br>
&gt; <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
&gt;<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Bill Burke<br>
JBoss, a division of Red Hat<br>
<a href="http://bill.burkecentral.com" target="_blank">http://bill.burkecentral.com</a><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<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" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
</div></div></blockquote></div><br></div>