刷新令牌Microsoft.Owin到期

时间:2016-12-09 17:57:16

标签: .net oauth owin

我像这样创建我的刷新令牌:

IClassFile

如果我评论public async Task CreateAsync(AuthenticationTokenCreateContext context) { var refreshTokenId = Guid.NewGuid().ToString("N"); context.Ticket.Properties.IssuedUtc = token.IssuedAtUtc; //context.Ticket.Properties.ExpiresUtc = DateTime.UtcNow.AddMonths(1); // Persist created token context.SetToken(refreshTokenId); } 行,我创建的刷新令牌永远不会过期(直到我将其删除/删除)是否正确?

1 个答案:

答案 0 :(得分:1)

By default刷新令牌Ticket.Properties.ExpiresUtc具有访问令牌的到期时间。

如果您希望刷新令牌没有过期,则需要在刷新令牌的提供商创建方法中设置ExpiresUtc null

<击>
context.Ticket.Properties.IssuedUtc = token.IssuedAtUtc;
context.Ticket.Properties.ExpiresUtc = null;

<击>

<强>更新

You can't具有刷新令牌,但没有到期时间。否则,您将获得{ "error": "invalid_grant" }