title: KeyCloak User validation and getting token
body: <p>First of all I am very new to Keycloak and excuse me if something I am asking might be wrong.</p>
  
  <p>I have installed the Keycloak server and I can access the Web UI for the same using:</p>
  
  <p><a href="http://localhost:8008/auth" rel="noreferrer">http://localhost:8008/auth</a></p>
  
  <p>My requirement is to validate a realm user by passing it to k
  Keycloak API and to get the token from there in response, and then pass this token for my other Web API calls.</p>
  
  <p>But I was not able to find a simple guide on how I can do this...</p>
  
  <p>UPDATE:</p>
  
  <hr>
  
  <p>USING UI from <code>KEYCLOAK</code>:</p>
  
  <p>So far now:</p>
  
  <ul>
  <li><p>I am able to create a <code>realm</code>:
  e.g: <code>DemoRealm</code></p></li>
  <li><p>Under the <code>Realm</code> I have created the client:
  e.g: <code>DemoClient</code></p></li>
  <li><p>Under the client I have created the user:
  e.g: <code>DemoUser</code> </p></li>
  </ul>
  
  <p>USING <code>POSTMAN</code>:</p>
  
  <p>I am also able to successfully get the token using</p>
  
  <pre><code>http://localhost:8080/auth/realms/DemoRelam/protocol/openid-connect/token
  
  POST:
  {
  "grant_type": "client_credentials",
  "username": "",
  "password": "",
  "client_secret":"",
  "client_id":"DemoClient"
  }
  </code></pre>
  
  <p>In response I am getting the token.</p>
  
  <pre><code>{
      "access_token": "eyJhbGciOiJSUzI1NiIsINVSHGhepnDu13SwRBL-v-y-04_6e6IJbMzreZwPI-epwdVPQe-ENhpvms2WdGM_DmgMLZ8YQFS4LDl9R7ZHT8AgXe-WCFV6OFkA7zvdeFwQ4kVVZE0HlNgHgoi4DrgMfwwz_ku1yJNJP3ztTY1nEqmA",
      "expires_in": 300,
      "refresh_expires_in": 1800,
      "refresh_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJRRnB5YlloMGVEektIdlhOb3JvaFUxdlRvWVdjdP3vbfvk7O0zvppK9N4-oaUqZSr0smHv5LkuLDQYdPuxA",
      "token_type": "bearer",
      "not-before-policy": 0,
      "session_state": "bb1c586a-e880-4b96-ac16-30e42c0f46dc"
  }
  </code></pre>
  
  <p>Furthermore I was diving into more details and found this API guide:</p>
  
  <p><a href="http://www.keycloak.org/docs-api/3.0/rest-api/index.html#_users_resource" rel="noreferrer">http://www.keycloak.org/docs-api/3.0/rest-api/index.html#_users_resource</a></p>
  
  <p>In this guide it's mentioned that I can get the users for the realm using
  Get users Returns a list of users, filtered according to query parameters</p>
  
  <pre><code>GET /admin/realms/{realm}/users
  </code></pre>
  
  <p>But when I am using <code>POSTMAN</code> to get the users I am getting <em>403</em> error code. I am passing the same token as on authentication which I got in the earlier step.</p>
  
  <pre><code>http://localhost:8080/auth/admin/realms/DemoRelam/users
  </code></pre>
  
  <p>Can anyone please guide me?</p>