<div dir="ltr">Hi,<div><br></div><div>I&#39;m trying to secure a bearer-only application with keycloak, to access it with access tokens, but I think I&#39;m missing something.</div><div><br></div><div>I tried it with the <font face="courier new, monospace">database-service</font> of the unconfigured demo.</div>
<div><br></div><div>1. I created the user role in the application.</div><div>2. I assigned that role to my user</div><div>3. I copied the contents of the installation json to <font face="courier new, monospace"><b>webapp/META-INF/keycloak.json</b></font></div>
<div><br></div><div><div><font face="courier new, monospace" color="#444444">{</font></div><div><font face="courier new, monospace" color="#444444">    &quot;realm&quot;: &quot;demo&quot;,</font></div><div><font face="courier new, monospace" color="#444444">    &quot;realm-public-key&quot;: &quot;MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwRayjzh7W+EfPaeSdyXWLyXof7c3fwD7vb0AEtG+ogLHtMkYiTdX9y/JXOmXwWDzGhx7NM3Q6vkCG0F3lZqOVsSlYH56c5+Ev4QmSGK/+6e+WcZMcgmscoz1OoXKom4+pzqMey42hqdwwMhkvCq/jxJSmUGnZJQuqEKVH00NZ1wIDAQAB&quot;,</font></div>
<div><font face="courier new, monospace" color="#444444">    &quot;bearer-only&quot;: true,</font></div><div><font face="courier new, monospace" color="#444444">    &quot;ssl-not-required&quot;: true,</font></div><div><font face="courier new, monospace" color="#444444">    &quot;resource&quot;: &quot;database-service&quot;,</font></div>
<div><font face="courier new, monospace" color="#444444">    &quot;use-resource-role-mappings&quot;: true</font></div><div><font face="courier new, monospace" color="#444444">}</font></div><div><br></div><div>4. Set the <font face="courier new, monospace">auth-method</font> to <b>KEYCLOAK</b> on <font face="courier new, monospace">web.xml</font></div>
<div>5. Started the server deploying the <font face="courier new, monospace"><b>database-service</b></font></div><div>6. Generated a token using <font face="courier new, monospace"><b>security-admin-console</b></font> client_id and my user</div>
<div>7. Submitted a GET request to <i><font face="courier new, monospace">localhost:8080/database/customers</font></i></div><div><br></div><div>After these steps I get a 403 error, saying that I&#39;m not authorized to access the resource, wasn&#39;t this supposed to work?</div>
<div><br></div>-- <br><div dir="ltr"><font face="Times New Roman">Rodrigo Sasaki</font><div></div></div>
</div></div>