title: C# Authorization roles in web API 2
body: <p>I have implemented a token based authentication web Api 2 application using OWIN middleware, authentication is made successfully where I can retrieve token and use it to get to the method of the web Api.</p>
  
  <p>However when I tried to add roles authorization, it doesn't work, I've searched thoroughly and found that I have to add in the "GrantResourceOwnerCredentials " in the oAuthorization provider the following:</p>
  
  <p><code>identity.AddClaim(new Claim(ClaimTypes.Role, "the role that i need to add"));</code></p>
  
  <p>The above line is all that I can get, it is also found in <a href="https://stackoverflow.com/questions/25661623/authorization-roles-webapi-oauth-owin">Authorization roles WebAPI oauth owin</a> </p>
  
  <p>However still whenever I use a token to get to any method(even authorized ones with different role) it still retrieve results normally.</p>
  
  <p>I mean when for example in the API Controller: it is like the following:</p>
  
  <pre><code> [Authorize(Roles = "Admin")]
      // GET api/Patient
      public IQueryable&lt;Patient&gt; GetPatients()
  </code></pre>
  
  <p>while in the "GrantResourceOwnerCredentials" method i have added only an Employee role:</p>
  
  <pre><code>var oAuthIdentity = new ClaimsIdentity(context.Options.AuthenticationType);
  oAuthIdentity.AddClaim(new Claim(ClaimTypes.Role, "Employee"));
  </code></pre>
  
  <p>Also, the Table in the server explorer that holds the roles "AspNetUserRoles" is not updated.</p>
  
  <p>What I'm missing???</p>