[英]Authentification to Azure Ad in Angular using Msal
I would authentificate to Azure AD . 我将对Azure AD进行身份验证。
I have Configured my app in module.app
我已经在
module.app
配置了我的应用程序
MsalModule.forRoot({
clientID: "ClientId",
authority: "https://login.microsoftonline.com/tenant.onmicrosoft.com/",
redirectUri: "http://localhost:4200/",
validateAuthority : true,
cacheLocation : "localStorage",
postLogoutRedirectUri: "http://localhost:4200/",
navigateToLoginRequestUrl : true,
popUp: true,
consentScopes: ["user.read", "api://??what_Id_Sould_I_Put???/access_as_user"],
unprotectedResources: ["https://angularjs.org/"],
correlationId: '1234',
piiLoggingEnabled: true,
}),
I my component I use loginPopup
method for connexion: 在我的组件中,我使用
loginPopup
方法进行连接:
this.authService.loginPopup(["user.read" ,"api://ClientId/access_as_user"]);
I get this error 我得到这个错误
AADSTS50001: The application named api://ClientId was not found in the tenant named de5e3c28-141c-4d3e-90ea-aa3326abe67d (Strange ID ).
AADSTS50001:在名为de5e3c28-141c-4d3e-90ea-aa3326abe67d(奇怪的ID)的租户中找不到名为api:// ClientId的应用程序。 This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant.
如果租户的管理员未安装该应用程序,或者该租户中的任何用户未同意该应用程序,则可能会发生这种情况。 You might have sent your authentication request to the wrong tenant.
您可能已将身份验证请求发送给错误的租户。
In the sample demo the ID used in ConsentScope variable is different than the Client ID , I don't know what is that ID and how to get it ? 在示例演示中, ConsentScope变量中使用的ID与客户端ID不同,我不知道该ID是什么以及如何获取它?
Just remove the line 只需删除行
consentScopes: ["user.read", "api://??what_Id_Sould_I_Put???/access_as_user"],
from the config. 从配置。 And change the line
并换线
this.authService.loginPopup(["user.read" ,"api://ClientId/access_as_user"]);
to 至
this.authService.loginPopup();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.