【发布时间】:2019-07-04 01:49:49
【问题描述】:
在做
msalService.loginPopup();
然后:
$rootScope.$on("msal:loginSuccess", function () {
console.log("loginSuccess");
var token = msalService.userInfo.idToken;
});
我可以看到userInfo.isAuthenticated 为真,并且存在一个 id 令牌。
但是,tokenReceivedCallback 永远不会被调用。
msalProvider.init({
clientID: "Client ID here",
authority: "https://login.microsoftonline.com/tfp/myb2caad.onmicrosoft.com/B2C_1_SignUpSignIn",
validateAuthority: false,
//consentScopes: ["https://myb2caad.onmicrosoft.com/test/user_impersonation"],
tokenReceivedCallback: function (errorDesc, token, error, tokenType) {
debugger;
if (token) {
console.log('Token type: ' + tokenType + ' Token: ' + token)
}
else {
console.log(errorDesc + error)
}
}
},
$httpProvider // Optionally, pass http provider to inject request interceptor to attach tokens
);
您能发现问题或给出一些提示吗?
【问题讨论】:
-
嗨@Leniel。 tokenReceivedCallback 只能通过重定向而不是提示来调用登录。
标签: angularjs azure-ad-b2c bearer-token msal msal.js