我是MSAL的新手,对一些看起来很简单的东西有困难。
我目前正在制作一个仪表盘应用程序,可以通过Microsoft Graph读取租户信息。到目前为止,我已经通过Azure门户创建了一个应用程序注册槽来添加新的租户。现在我想自动化这个过程,让用户登录,并让应用程序为他创建注册。
我使用this tutorial开始使用MSAL,一切都很好,直到我尝试请求更多的优先级
我的理解是,我需要将我需要的预留添加到MsalModule中的同意范围中
MsalModule.forRoot(
{
auth: {
clientId: "c91b9c1f-662c-491c-870c-fff04dd9b065",
redirectUri: "https://parigxprz.github.stackblitz.io"
},
cache: {
cacheLocation: "localStorage",
storeAuthStateInCookie: isIE // set to true for IE 11
}
},
{
popUp: !isIE,
//adding extra premissions here
consentScopes: ["user.read", "openid", "profile", "calendar.read","mail.read"],
protectedResourceMap: [
['https://graph.microsoft.com/v1.0/me', ['user.read']],
],
unprotectedResources: [],
extraQueryParameters: {}
}
)它会出现在这里

现在,不幸的是,这似乎不是我的情况,因为它只要求提前阅读基本个人资料,而不是日历或邮件。我还尝试将它添加到loginpopup调用中,如下所示
this.authService.loginPopup({
extraScopesToConsent: ["user.read", "openid", "profile", "calendar.read","mail.read"]
});但这似乎并没有太大的改变。
下面是使用azure示例github中的示例应用程序的stackblitz。
https://stackblitz.com/edit/github-o6tcvk?file=src%2Fapp%2Fapp.component.ts
任何帮助都将不胜感激。
发布于 2020-11-01 01:48:00
你需要在Azure门户的应用程序注册中对此进行配置。查看api部分,并在图形api下选择适当的权限。您可能必须先授予管理员同意,然后用户才能批准访问。
https://stackoverflow.com/questions/64624030
复制相似问题