简体   繁体   English

Angularjs不通过Azure Active Directory进行身份验证

[英]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.

相关问题 如何使用Azure Active Directory身份验证库对Angularjs应用程序进行身份验证? - How to authenticate Angularjs application using Azure Active Directory Authentication Library? 当您必须登录时,Azure Active Directory(ADAL)不会将您重定向到您尝试打开的页面 - Azure Active directory (ADAL) doesn't redirect you to the page you are trying to open when you have to login AngularJS 组件和 ADAL(用于 JS 的 Active Directory Azure 库) - AngularJS Components and ADAL (Active Directory Azure Library for JS) 使用 Active Directory(使用 LDAP)在 angularjs/javascript 前端进行身份验证 - 流程的流程应该是什么? - Using Active Directory (with LDAP) to authenticate on an angularjs/javascript fronted - what should the flow of the process be? 无法获得Angular SPA来使用Azure Active Directory验证ASP.NET MVC WebAPI - Cannot get an Angular SPA to authenticate an ASP.NET MVC WebAPI with Azure Active Directory AngularJS UI路由器设置活动链接不起作用 - angularjs ui-router set active link doesn't work Adal angularjs - Azure 活动目录:从 URL/查询字符串中隐藏 id_token - Adal angularjs - Azure active directory : hide id_token from URL/querystring 没有用户交互,AngularJS目录不会更新 - AngularJS directory doesn't update without user interaction Typescript AngularJS服务在WebDeploy到Azure上不起作用 - Typescript AngularJS service doesn't work on WebDeploy to Azure 在页面加载 MVC 时根据活动目录对用户进行身份验证 - Authenticate users against active directory on page load MVC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM