IdentityServer4 refresh_token撤销

时间:2017-06-05 09:10:04

标签: c# asp.net-core identityserver4

我有一个SPA应用程序,它使用IdentityServer4 ROPC流程进行身份验证,并通过此示例https://github.com/robisim74/AngularSPAWebAPI访问和刷新令牌。我每15分钟更新一次刷新和访问令牌的refresh_token。

但是如果我重新启动IdentityServer4应用程序,那么在重新启动之前发出的旧的refresh_tokens不再有效。怎么解决?我怀疑我应该实现一些接口来存储发布的刷新令牌?

1 个答案:

答案 0 :(得分:2)

您需要使用IPersistedGrantStore合同来实施持久授权。这会将refresh_tokens之类的内容存储到已定义的持久性中。默认情况下,IdentityServer 4将使用InMemory持久性存储,这就是您在重新启动应用程序时不断丢失refresh_token引用的原因。

如果您打算使用refresh_tokens,则必须在生产中使用持久层。