title: How I return a bearer access token from a controller in webapi
body: <p>I am using the asp identity framework and I'm trying to use it with bearer tokens.</p>
  
  <p>I would like to return an access token from the Register method in my webapi controller in the same format that is returned by the owin middleware when posting username/password details to the TokenEndpointPath.</p>
  
  <p>All the examples I have seen relate to cookie based authentication, and they simply call AuthenticationManager.Signin(properties, identity) after the user has registered.</p>
  
  <p>I would like to be able to return a response similar to the following:</p>
  
  <pre><code>{"access_token":"access-token","token_type":"bearer","expires_in":1209599,"userName":"username",".issued":"Sat, 22 Mar 2014 08:12:14 GMT",".expires":"Sat, 05 Apr 2014 08:12:14 GMT"}
  </code></pre>
  
  <p>Do I have to create my own class and serialize all these fields myself when the functionality to this must already exist somewhere?</p>