title: How can I rename Web Api Bearer Token ".expires" key?
body: <p>A response from /Token returns a payload that looks something like this:</p>
  
  <pre><code>"access_token":"foo",
  "token_type":"bearer",
  "expires_in":59,
  "refresh_token":"bar",
  ".issued":"Sat, 17 Sep 2016 00:13:21 GMT",
  ".expires":"Sat, 17 Sep 2016 00:14:21 GMT"
  </code></pre>
  
  <p>Is there a reason .issued and .expired named they way they are? These are not valid JavaScript properties so I intend to rename them. If there a more elegant way to do this besides overriding the <code>TokenEndpoint</code> method like this:</p>
  
  <pre><code>public override Task TokenEndpoint(OAuthTokenEndpointContext context)
  {
      foreach (KeyValuePair&lt;string, string&gt; property in context.Properties.Dictionary)
      {
          string key = property.Key;
          switch (key)
          {
              case ".expires":
                  key = "expires";
                  break;
              case ".issued":
                  key = "issued";
                  break;
          }
          context.AdditionalResponseParameters.Add(key, property.Value);
      }
      return Task.FromResult&lt;object&gt;(null);
  }
  </code></pre>
  
  <p>An example of why I want to do this. I like to provide a TypeScript interface that mimics the data I expect to receive from a request. In this case, my interface looks like this:</p>
  
  <pre><code>interface IToken {
      .expires: string;        // Not valid TypeScript
      .issued: string;         // Not valid TypeScript
      access_token: string;
      expires_in: number;
      token_type: string;
      refresh_token: string;
  }
  </code></pre>
  
  <p>Without changing the property in my API, I and others using my API are forced to access these properties using magic strings like <code>tokenVar[".expires"]</code></p>