<div dir="ltr">I always forget that part.<div><br></div><div>Do I always have to provide a user when I want to do this? Is it possible for an OAuth Client to authenticate based on name and client secret to get an access token?</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 10, 2014 at 5:22 PM, 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">You need to add a scope to &quot;myclient&quot; that allows &quot;myclient&quot; to ask for admin privileges.<div class="">
<br>
<br>
On 6/10/2014 4:14 PM, Rodrigo Sasaki wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
Yes it had them, but it didn&#39;t work.<br>
<br>
When I tried generating the token with the client_id set to the<br>
security-admin-console application it worked fine.<br>
<br>
Is that the correct way to do this?<br>
<br>
<br>
On Tue, Jun 10, 2014 at 4:26 PM, Bill Burke &lt;<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a><br></div><div class="">
&lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;&gt; wrote:<br>
<br>
    Does rodrigosasaki have realm admin privileges?  The role is under<br>
    applications-&gt;myrealm-<u></u>management-&gt;realm-admin<br>
<br>
    On 6/10/2014 3:02 PM, Rodrigo Sasaki wrote:<br>
     &gt; I&#39;d like to manage users and roles, creating and updating them.<br>
     &gt;<br>
     &gt; I obtained a token like this:<br>
     &gt;<br>
     &gt; *POST /realms/myrealm/tokens/grants/<u></u>access*<br>
     &gt; *<br>
     &gt; *<br>
     &gt; *username: rodrigosasaki*<br>
     &gt; *password: password*<br>
     &gt; *client_id: myclient*<br>
     &gt; *client_secret: generated_secret*<br>
     &gt;<br>
     &gt; and I got a token back, but then I tried accessing the roles of the<br>
     &gt; realm on this URL<br>
     &gt;<br>
     &gt; /admin/realms/myrealm/roles<br>
     &gt;<br>
     &gt; And it says I&#39;m not authorized to access this, I&#39;d like to know what<br>
     &gt; roles or configuration I should create to be able to manipulate this<br>
     &gt; information, just as I do on the admin-console<br>
     &gt;<br>
     &gt;<br>
     &gt; On Tue, Jun 10, 2014 at 10:16 AM, Stian Thorgersen<br>
    &lt;<a href="mailto:stian@redhat.com" target="_blank">stian@redhat.com</a> &lt;mailto:<a href="mailto:stian@redhat.com" target="_blank">stian@redhat.com</a>&gt;<br></div><div class="">
     &gt; &lt;mailto:<a href="mailto:stian@redhat.com" target="_blank">stian@redhat.com</a> &lt;mailto:<a href="mailto:stian@redhat.com" target="_blank">stian@redhat.com</a>&gt;&gt;&gt; wrote:<br>
     &gt;<br>
     &gt;     To access the REST API you need to pass the token in the http<br>
     &gt;     headers. How to obtain the token in the first place depends<br>
    on the<br>
     &gt;     type of the application you&#39;re trying to invoke the API from.<br>
    Look<br>
     &gt;     at the docs/examples that corresponds to the type of your app<br>
     &gt;     (JavaScript, command-line, jax-rs, etc). You also need to<br>
    make sure<br>
     &gt;     the application/client has scope mappings on the required roles.<br>
     &gt;<br>
     &gt;     ----- Original Message -----<br>
     &gt;      &gt; From: &quot;Rodrigo Sasaki&quot; &lt;<a href="mailto:rodrigopsasaki@gmail.com" target="_blank">rodrigopsasaki@gmail.com</a><br>
    &lt;mailto:<a href="mailto:rodrigopsasaki@gmail.com" target="_blank">rodrigopsasaki@gmail.<u></u>com</a>&gt;<br></div><div class="">
     &gt;     &lt;mailto:<a href="mailto:rodrigopsasaki@gmail.com" target="_blank">rodrigopsasaki@gmail.<u></u>com</a><br>
    &lt;mailto:<a href="mailto:rodrigopsasaki@gmail.com" target="_blank">rodrigopsasaki@gmail.<u></u>com</a>&gt;&gt;&gt;<br>
     &gt;      &gt; To: <a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a><br>
    &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;<br></div><div><div class="h5">
     &gt;     &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a><br>
    &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;&gt;<br>
     &gt;      &gt; Sent: Monday, 9 June, 2014 12:59:41 PM<br>
     &gt;      &gt; Subject: [keycloak-user] REST API - Bearer Exception<br>
     &gt;      &gt;<br>
     &gt;      &gt; Hi,<br>
     &gt;      &gt;<br>
     &gt;      &gt; I&#39;m trying to work with the Keycloak REST API, I logged<br>
    into the<br>
     &gt;      &gt; administration console, and then tried accessing<br>
     &gt;     /auth/admin/realms and got<br>
     &gt;      &gt; this exception:<br>
     &gt;      &gt;<br>
     &gt;      &gt; Failed executing GET /admin/realms:<br>
     &gt;      &gt; org.jboss.resteasy.spi.<u></u>UnauthorizedException: Bearer<br>
     &gt;      &gt;<br>
     &gt;      &gt; How should I build my request to be able to get a<br>
    response? How<br>
     &gt;     should I<br>
     &gt;      &gt; authenticate myself in this situation?<br>
     &gt;      &gt;<br>
     &gt;      &gt; --<br>
     &gt;      &gt; Rodrigo Sasaki<br>
     &gt;      &gt;<br>
     &gt;      &gt; ______________________________<u></u>_________________<br>
     &gt;      &gt; keycloak-user mailing list<br>
     &gt;      &gt; <a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a><br>
    &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;<br></div></div>
    &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a><div class=""><br>
    &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;&gt;<br>
     &gt;      &gt; <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/keycloak-user</a><br>
     &gt;<br>
     &gt;<br>
     &gt;<br>
     &gt;<br>
     &gt; --<br>
     &gt; Rodrigo Sasaki<br>
     &gt;<br>
     &gt;<br>
     &gt; ______________________________<u></u>_________________<br>
     &gt; keycloak-user mailing list<br>
     &gt; <a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a> &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;<br>

     &gt; <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/keycloak-user</a><br>
     &gt;<br>
<br>
    --<br></div><div class="">
    Bill Burke<br>
    JBoss, a division of Red Hat<br>
    <a href="http://bill.burkecentral.com" target="_blank">http://bill.burkecentral.com</a><br>
    ______________________________<u></u>_________________<br>
    keycloak-user mailing list<br></div><div class="">
    <a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a> &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;<br>

    <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/keycloak-user</a><br>
<br>
<br>
<br>
<br>
--<br>
Rodrigo Sasaki<br>
</div></blockquote>
<br><div class="HOEnZb"><div class="h5">
-- <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>
</div></div></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>