<div dir="ltr">I&#39;d like to manage users and roles, creating and updating them.<div><br></div><div>I obtained a token like this:</div><div><br></div><div><b>POST /realms/myrealm/tokens/grants/access</b></div><div><b><br>
</b></div><div><b>username: rodrigosasaki</b></div><div><b>password: password</b></div><div><b>client_id: myclient</b></div><div><b>client_secret: generated_secret</b></div><div><br></div><div>and I got a token back, but then I tried accessing the roles of the realm on this URL</div>
<div><br></div><div>/admin/realms/myrealm/roles<br></div><div><br></div><div>And it says I&#39;m not authorized to access this, I&#39;d like to know what roles or configuration I should create to be able to manipulate this information, just as I do on the admin-console</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 10, 2014 at 10:16 AM, Stian Thorgersen <span dir="ltr">&lt;<a href="mailto:stian@redhat.com" target="_blank">stian@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">To access the REST API you need to pass the token in the http headers. How to obtain the token in the first place depends on the type of the application you&#39;re trying to invoke the API from. Look at the docs/examples that corresponds to the type of your app (JavaScript, command-line, jax-rs, etc). You also need to make sure the application/client has scope mappings on the required roles.<br>

<div><div class="h5"><br>
----- Original Message -----<br>
&gt; From: &quot;Rodrigo Sasaki&quot; &lt;<a href="mailto:rodrigopsasaki@gmail.com">rodrigopsasaki@gmail.com</a>&gt;<br>
&gt; To: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
&gt; Sent: Monday, 9 June, 2014 12:59:41 PM<br>
&gt; Subject: [keycloak-user] REST API - Bearer Exception<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; I&#39;m trying to work with the Keycloak REST API, I logged into the<br>
&gt; administration console, and then tried accessing /auth/admin/realms and got<br>
&gt; this exception:<br>
&gt;<br>
&gt; Failed executing GET /admin/realms:<br>
&gt; org.jboss.resteasy.spi.UnauthorizedException: Bearer<br>
&gt;<br>
&gt; How should I build my request to be able to get a response? How should I<br>
&gt; authenticate myself in this situation?<br>
&gt;<br>
&gt; --<br>
&gt; Rodrigo Sasaki<br>
&gt;<br>
</div></div>&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>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><font face="Times New Roman">Rodrigo Sasaki</font><div></div></div>
</div>