Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是使用 JwtHelper 的应用程序使用基于令牌的身份验证,通过 canActivate 方法验证路由器更改并重定向到登录页面。
但是在令牌过期或删除本地存储后,页面不会重定向到登录页面。
如何验证应用程序的所有操作?
守卫仅在路由级别起作用,根据您的需要,我建议您为令牌更改设置一个 Observable,以便在您的页面中您可以订阅它,现在正是令牌过期或删除的时间。