title: ASP Core Add Custom Claim to Auth Token
body: <p>I'm using openiddict and ASP Identity, and I am trying add a "GroupId" as a claim to the auth token that is returned when logging in (using the /connect/token endpoint - see example I followed below). The GroupId is a property in my AplicationUser class.</p>
  
  <p>I have tried using an <code>IClaimsTransformer</code> but that seems clunky, I can't easily get to the UserManager from the ClaimsTransformationContext.</p>
  
  <p>How would I go about either getting the UserManager through DI in my <code>IClaimsTransformer</code> or just adding the GroupId to the token that is generated at the connect/token endpoint?</p>
  
  <p>I followed <a href="http://kerryritter.com/authorizing-your-net-core-mvc6-api-requests-with-openiddict-and-identity/" rel="nofollow">this</a> example for setting up my site.  This is what I would like to do: </p>
  
  <pre><code>var groupGuid = User.Claims.FirstOrDefault(c =&gt; c.Type == "GroupGuid");
  </code></pre>