title: Getting user keycloak Not Found exception
body: <p>I can't get user groups like in samples.
  Samples from:
  Take a look at our testsuite. For example:</p>
  
  <p><a href="https://github.com/keycloak/keycloak/blob/2.5.0.Final/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/UserTest.java#L837-L915" rel="noreferrer">UserTest</a></p>
  
  <p><a href="https://github.com/keycloak/keycloak/blob/2.5.0.Final/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/group/GroupTest.java#L425-L495" rel="noreferrer">GroupTest</a></p>
  
  <p>Sample code from examples for receiving groups user is member of:</p>
  
  <pre><code>List&lt;GroupRepresentation&gt; membership = realm.users().get(user.getId()).groups();
  </code></pre>
  
  <p>My approach:
  1. I create keycloak object for admin-cli client in myrealm realm:</p>
  
  <pre><code>this.keycloak = KeycloakBuilder.builder()
              .serverUrl("http://localhost:18080/auth")
              .realm("myrealm")
              .username("admin")
              .password("admin")
              .clientId("admin-cli")
              .resteasyClient(new ResteasyClientBuilder().connectionPoolSize(10).build())
              .build();
  </code></pre>
  
  <ol start="2">
  <li><p>When I try to get user:</p>
  
  <pre><code>//this line works
  final UserResource userr = this.keycloak.realms().realm("myrealm").users().get("admin");
  
  //this two doesnt, in both result is javax.ws.rs.NotFoundException: HTTP 404 Not Found
  final UserRepresentation ur = userr.toRepresentation();
  final List&lt;GroupRepresentation&gt; groups = this.getRealm().users().get(user.getId()).groups();
  </code></pre></li>
  </ol>
  
  <p>In keycloak from admin-cli I created realm "myrealm" with 2 users and 2 groups
  Every user is member of both groups. admin is one of this users and is member of this two groups.</p>
  
  <p>Users I've created are in "myrealm" realm, "admin" is one of them.</p>
  
  <p>I've olso tried to give all available roles from clients and realm but this changes nothing.</p>
  
  <p>admin-cli I meant keycloak app on localhost</p>
  
  <p><strong>What am I missing?</strong></p>
  
  <p>Libs I am using:</p>
  
  <pre><code>import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
  import org.keycloak.admin.client.Keycloak;
  import org.keycloak.admin.client.KeycloakBuilder;
  import org.keycloak.admin.client.resource.RealmResource;
  import org.keycloak.admin.client.resource.UserResource;
  import org.keycloak.admin.client.resource.UsersResource;
  import org.keycloak.representations.idm.GroupRepresentation;
  import org.keycloak.representations.idm.UserRepresentation;
  </code></pre>