2

我有一个使用 Azure Active Directory 进行身份验证的 angularjs Web 应用程序。应用程序使用的 Web Api 进行身份验证时没有任何错误。

对于客户端身份验证,我使用 adal.js 和 adal-angular.js。当我尝试访问我的应用程序中的任何页面时,身份验证失败并在控制台中打印以下消息

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

我已按照教程进行操作。

有谁知道发生了什么或我该如何调试?

4

2 回答 2

3

当令牌未正确解码 utf-8 字符时,错误出现在 adal.js 库中。

带有错误修复的库的更新版本将很快推出。

于 2015-01-21T07:26:20.913 回答
1

没有看到代码示例很难回答。如果您使用的是 Promise,则如果 Promise 被拒绝,您需要处理这种情况。你可能有这样的事情:

    myAuthService.authenticate(...).then(function(data){
       //this handles the successful call.
    });

你需要看到的错误是这样的:

        myAuthService.authenticate(...).then(function(data){
           //this handles the successful call.
        }, function(e){
           //this handles the error case
           alert('errror.  inspect this.arguments');
});

您应该发布引发错误的代码。

于 2015-01-19T13:49:00.873 回答