成功通过Identity Server验证后,将返回一个令牌,并将用户重定向到app.ts
。但是,当我在app.ts
中调用getUser()
时,它返回null
。这段代码在本地主机中工作正常,但当我在生产环境中尝试它时,它不能工作(返回null
)。
app.ts
constructor(private openIdConnect: OpenIdConnect, private httpClient: HttpClient) {
debugger;
let mgr = this.openIdConnect.userManager;
this.openIdConnect.userManager.getUser().then((user) => {
if (user) {
this.user = user;
console.log(" This.User: "+this.user);
console.log(" User: "+ user)
}else{
console.log(" logout ");
this.logout();
}
});
}
发布于 2018-07-20 14:27:43
问题是我把应用构建成production.So的方式,之前我用了"au build --env prod
“,我把它改成了”au build --env
“。
https://stackoverflow.com/questions/51421843
复制相似问题