【发布时间】:2020-04-10 21:10:11
【问题描述】:
我正在尝试使用 angular9 和 microsoft/msal 从 AAD B2C 配置中获取令牌
我的模块配置是这样的;
MsalModule.forRoot(
{
auth: {
clientId: "xxxxxxxxxxxxxxxxx",
authority:
"https://login.microsoftonline.com/tfp/isthereanynewscodeblast.onmicrosoft.com/B2C_1_itansignup",
validateAuthority: false,
},
cache:{
cacheLocation:"localStorage",
storeAuthStateInCookie:true
}
}
),
下一次登录后,我会尝试为图形数据或我的自定义范围获取更多数据,如下所示:
getToken() {
const accessTokenRequest = {
scopes: [
"https://graph.microsoft.com/User.Read",
// // "https://isthereanynewscodeblast.onmicrosoft.com/05cd7635-e6f4-47c9-a5ce-8ec04368b297/application_reader",
// // "https://isthereanynewscodeblast.onmicrosoft.com/05cd7635-e6f4-47c9-a5ce-8ec04368b297/application_writer",
],
clientId: "xxxxxxxxxxxxxxxx",
authority: "https://login.microsoftonline.com/tfp/isthereanynewscodeblast.onmicrosoft.com/B2C_1_itansignup",
redirectUri: "http://localhost:4200",
// postLogoutRedirectUri: 'http://localhost:4200/',
};
this.authService
.acquireTokenSilent(accessTokenRequest)
.then((res) => {
console.log("acquireTokenPopup");
this.token = res.accessToken;
this.getUser();
})
.catch((e) => {
console.log("acquireTokenPopup catch");
console.log(e);
});
}
获取令牌失败并出现以下错误:
InteractionRequiredAuthError: AADB2C90077: User does not have an existing session and request prompt parameter has a value of 'None'.
我不知道我做错了什么或在哪里寻找答案:
-
我的示波器看起来不错(^C^V - 名称和链接)
-
我尝试将用户流会话行为更改为禁用
-
更改
acquireTokenPopup返回此错误:ServerError: AADB2C90205: This application does not have sufficient permissions against this web resource to perform the operation.
【问题讨论】:
标签: angular azure azure-ad-b2c msal