ASP .NET Web Api OAuth 刷新令牌过期时间
ASP .NET Web Api OAuth refresh token expiration time
我有一个类似的问题
owin ticket include refresh token related data in response
你知道如何return刷新令牌的到期日期和时间吗?
您可以找到一个工作示例 here。这是一个 Web Api + Owin self-托管。
客户端是一个控制台应用程序(还有一个 html + JavaScript 示例)调用 Web Api 传递凭据。
您需要覆盖 TokenEndpoint
:
public override Task TokenEndpoint(OAuthTokenEndpointContext context)
{
foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
{
if(property.Key == ".expires")
context.AdditionalResponseParameters.Add(property.Key, property.Value);
}
return Task.FromResult<object>(null);
}
我有一个类似的问题 owin ticket include refresh token related data in response
你知道如何return刷新令牌的到期日期和时间吗?
您可以找到一个工作示例 here。这是一个 Web Api + Owin self-托管。
客户端是一个控制台应用程序(还有一个 html + JavaScript 示例)调用 Web Api 传递凭据。
您需要覆盖 TokenEndpoint
:
public override Task TokenEndpoint(OAuthTokenEndpointContext context)
{
foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
{
if(property.Key == ".expires")
context.AdditionalResponseParameters.Add(property.Key, property.Value);
}
return Task.FromResult<object>(null);
}