[英]Angularjs doesn't authenticate with Azure Active Directory
I have an angularjs web application that uses Azure Active Directory for authentication. 我有一个使用Azure Active Directory进行身份验证的angularjs Web应用程序。 The Web Api that the application uses, authenicates without any errors. 应用程序使用的Web Api进行身份验证,没有任何错误。
For client-side authentication I am using adal.js and adal-angular.js. 对于客户端身份验证,我正在使用adal.js和adal-angular.js。 When i try to visit any page in my app, authentication fails and prints the following messages in the console 当我尝试访问应用程序中的任何页面时,身份验证失败并在控制台中显示以下消息
The returned id_token is not parseable.
Route change event for:/
Start login at:https://localhost:44308/#
Navigate url:https://login.windows.net/myapp.onmicrosoft.com/oauth2/authorize
Navigate to:https://login.windows.net/myapp.onmicrosoft.com/oauth2/authorize
TypeError: Cannot read property 'data' of undefined
I have followed this tutorial. 我遵循了本教程。
Does anyone know what is going on or how can I debug this? 有谁知道发生了什么或如何调试呢?
The error was in the adal.js library when the token which didn't decode correctly utf-8 characters. 错误是当adal.js库中的令牌无法正确解码utf-8字符时。
An updated version of the library with the bug fix will be available soon. 带有错误修复程序的库的更新版本即将推出。
It's tough to answer without seeing a code sample. 不看代码示例就很难回答。 If you're using promises, you need to handle the case if the promise is rejected. 如果您使用诺言,则在诺言被拒绝的情况下需要处理此案。 You probably have something like this: 您可能有这样的事情:
myAuthService.authenticate(...).then(function(data){
//this handles the successful call.
});
What you need to see the error is something like this: 您需要查看错误是这样的:
myAuthService.authenticate(...).then(function(data){
//this handles the successful call.
}, function(e){
//this handles the error case
alert('errror. inspect this.arguments');
});
You should post the code that is throwing the error. 您应该发布引发错误的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.