Joehom Sum
Joehom Sum

Reputation: 332

OAuth2 WebAPI Token remove .issued and .expires

The token is always returned following information:

{
  "access_token": ".....",
  "token_type": "bearer",
  "expires_in": 1199,
  "custom_info1": ".....",
  "custom_info2": "....",
  ".expires": "Fri, 13 Nov 2015 20:24:06 GMT",
  ".issued": "Fri, 13 Nov 2015 20:04:06 GMT"
}

Can we remove the .expires and .issued information?

Upvotes: 1

Views: 235

Answers (1)

Mahboobeh Sharghi
Mahboobeh Sharghi

Reputation: 26

Hi You can remove them by override the TokenEndpointResponse method

public override Task TokenEndpointResponse(OAuthTokenEndpointResponseContext context)
    {
        foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
        {
         if (property.Key != ".issued" && property.Key != ".expires")
            {
                context.AdditionalResponseParameters.Add(property.Key, property.Value);
            }
        }
        return Task.FromResult<object>(null);
    }

Upvotes: 1

Related Questions