firefox - 在 Azure 上托管 AD b2c 的 aurelia 应用程序,重定向回登录 Edge 和 Firefox
问题描述
我有一个使用 Msal JavaScript 库通过 Azure B2C 进行身份验证的 Aurelia 应用程序。
它托管在 Azure 应用服务上,在 Chrome 中运行良好,但在 Edge 和 Firefox 中,当应用启动时,我被重定向回 Azure B2C 登录屏幕。
这是我的 main.ts:
aurelia.start().then((a) => {
let auth: Auth = a
.container
.get(Auth);
setTimeout(() => {
auth
.isAuthenticated()
.then(() => {
a.setRoot();
return;
})
.catch((e) => {
auth.login();
});
}, 2000);
这是 isAuthenticated 方法:
isAuthenticated() {
return new Promise((resolve, reject) => {
let cachedUser = this
.clientApplication
.getUser();
if (cachedUser == null) {
this.authenticated = false;
return reject();
}
let token = this._getTokentInternal();
if (token) {
this.authenticated = true;
return resolve();
} else {
return reject();
}
});
}
当我使用 Aurelia cli 在 Localhost 上运行时,这工作正常,所有三个浏览器都可以工作,但是当我发布到 azure 时,即使 azure 登录成功,Edge 和 Firefox 也会不断从 isAuthenticated 方法收到拒绝的承诺响应,这会强制重定向到登录。
有没有其他人遇到过这个问题?
谁能指出我正确的方向来解决这个问题?
解决方案
似乎我的登录方法清除了 window.location.hash,我删除了该行,它现在似乎正在工作
推荐阅读
- c++ - 将非拥有位容器基于 std::vector 是个好主意吗
? 标准::跨度? - git - 提示落后,但拉动更改无效
- r - R中的数据比较
- r - 如何在ggplot2中放置大量x标签或隔开x标签
- flask - 在 Flask-SQLAlchemy 中:如何在 config.py 中设置 check_same_thread=False?
- jenkins - 詹金斯脚本化管道junit测试结果
- machine-learning - 如何将图像作为标签给 keras 模型?
- wordpress - 在我的 woocommerce 购物车中获取 2 个产品而不是 1 个
- testing - 获取依赖映射 API [pact-broker]
- css - CSS Webkit 动画在 iOS 11 中不起作用