【发布时间】:2019-10-26 06:15:45
【问题描述】:
Auth0 问题。
我的应用程序在浏览器刷新时注销后重新触发登录事件,并且用户配置文件出现问题。我在身份验证服务中追踪到 parseHash:
this.auth0.parseHash({ hash: window.location.hash }, (err, authResult) => {
...
}
使用 ngrx 效果触发:
@Effect()
init$ = defer(() => {
const userData = localStorage.getItem("user");
if (userData != null && userData != 'undefined') {
let authActionObservable = of(new Login({user: JSON.parse(userData)}));
this.authService.handleAuthentication();
return authActionObservable;
}
this.authService.handleAuthentication();
});
似乎 this.auth0.parseHash 在页面刷新后为 authResult 和 err 返回 null 但在初始登录时 authResult 填充正确。
从技术上讲,登录是成功的,我得到了令牌。我检查了整个配置、域等,一切似乎都很好。我也尝试过使用 { hash: window.location.hash }。
【问题讨论】:
标签: angular typescript authentication auth0