angular - AADSTS50146:此应用程序需要使用特定于应用程序的签名密钥进行配置
问题描述
我正在创建一个 Angular 7 应用程序。我们使用 angular-oauth2-oidc 连接到 Azure AD 并进行身份验证。Azure AD 设置为 OPENID 进行身份验证。从管理 Azure AD 的团队中,我们也得到了一个密钥。因为我是新手,所以我无法弄清楚需要在哪里使用。在网上搜索也没有得到太多帮助。
当我发布此代码并打开应用程序时,它会被重定向,但在登录 micosoft 网站本身后,它会抛出以下错误
AADSTS50146:此应用程序需要使用特定于应用程序的签名密钥进行配置。
任何人都可以帮助解决这个问题。
下面是我们在 app.component.ts 中使用的代码示例
export const authConfig: AuthConfig = {
issuer: 'https://sts.windows.net/<tanend id>/',
redirectUri: window.location.origin + '/',
logoutUrl: 'https://login.microsoftonline.com/<tanend id>/oauth2/logout',
clientId: '<cliend id>',
strictDiscoveryDocumentValidation: false,
responseType: 'id_token',
scope: 'openid profile email',
waitForTokenInMsec: 2000,
oidc: true
};
private async ConfigAuth(): Promise<void> {
this.oauthService.configure(authConfig);
this.oauthService.setStorage(sessionStorage);
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
this.oauthService.requireHttps = true;
}
constructor(private oauthService: OAuthService) { }
async ngOnInit(){
await this.ConfigAuth();
if (!this.oauthService.getAccessToken()) {
this.oauthService.loadDiscoveryDocument().then((doc) => {
this.oauthService.tryLogin()
.catch(err => {
console.error(err);
})
.then(() => {
// this.router.navigate(['/'])
if (!this.oauthService.hasValidAccessToken()) {
this.oauthService.initImplicitFlow()
}
});
});
}
console.log(this.oauthService.getAccessToken());
}
解决方案
这是通过在 AD 方面进行更改来解决的(完成的是单独的团队,没有太多细节)还借助以下链接修改了代码 https://damienbod.com/2018/01/23/using-the-dotnet-angular-带有 azure-ad-oidc-implicit-flow 的模板/
推荐阅读
- html - Angular - 无法匹配路线 - 网址段 [已回答]
- keras - 将keras中的conv2d逐帧应用于视频输入
- c# - 下载 .nupkg 的旧版本 (1.9.2.3) 而不是最新版本 (1.9.2.5)
- c# - 按 2 个属性聚合列表项并在 C# 中对第 3 个求和
- node.js - Promises 在定义时执行而不是 Promises.all?
- reactjs - 在谷歌中使用 Firebase Auth 时如何在 Expo Go 中启用弹出窗口?
- firebase - 当来自 rnfirebase 的 firestore 包时,数据未存储在 Firestore 中
- sql - 根据某些列过滤表中的记录
- excel - 如何过滤第一个日期和时间
- angular - 元素隐式具有“任何”类型,因为“任何”类型的表达式不能用于索引类型,任何人都可以告诉我