<div dir="ltr">I'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'm not authorized to access this, I'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"><<a href="mailto:stian@redhat.com" target="_blank">stian@redhat.com</a>></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'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>
> From: "Rodrigo Sasaki" <<a href="mailto:rodrigopsasaki@gmail.com">rodrigopsasaki@gmail.com</a>><br>
> To: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
> Sent: Monday, 9 June, 2014 12:59:41 PM<br>
> Subject: [keycloak-user] REST API - Bearer Exception<br>
><br>
> Hi,<br>
><br>
> I'm trying to work with the Keycloak REST API, I logged into the<br>
> administration console, and then tried accessing /auth/admin/realms and got<br>
> this exception:<br>
><br>
> Failed executing GET /admin/realms:<br>
> org.jboss.resteasy.spi.UnauthorizedException: Bearer<br>
><br>
> How should I build my request to be able to get a response? How should I<br>
> authenticate myself in this situation?<br>
><br>
> --<br>
> Rodrigo Sasaki<br>
><br>
</div></div>> _______________________________________________<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>
</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>