Identity Server 4 Angular 2 令牌过期

Identity Server 4 Angular 2 token expiration

我正在寻找有关如何最好地使用 Angular 2 和 Identity Server 4 处理令牌过期的建议。我正在使用 Identity Server 4 的隐式流,它不发布刷新令牌,我不想在令牌过期后重定向用户。

另外,为什么没有刷新令牌?为什么混合流程不适用于 javascript 客户?我确实控制了 ID 服务器、应用程序和 api 这样可以吗?

我可以推荐用于管理 javascript 应用程序令牌的库: https://github.com/IdentityModel/oidc-client-js

您已正确使用 SPA 的隐式流程 - 以下是关于哪个流程正确的描述 - https://leastprivilege.com/2016/01/17/which-openid-connectoauth-2-o-flow-is-the-right-one/

Oidc-client 提供了名为 automaticSilentRenew - check the docs 的强大功能。后台有计时器,在令牌过期前处理事件,并使用隐藏的 iframe 获取新的访问令牌。

Angular2oidc-client 的示例: https://github.com/jmurphzyo/Angular2OidcClient

使用 IdentityServer 在 JavaScript 网络应用程序中进行身份验证和授权概述的视频 - https://vimeo.com/131636653