2

"@azure/msal-angular": "^0.1.2"在两个项目中都使用 msal.js Angular 6,但Angular 7出现以下错误:

SCRIPT1002: Syntax error
vendor.js (64379,1)

第 64379 行的 .js 代码

class AuthenticationResult {
constructor(token, tokenType) {
    this._token = "";
    this._tokenType = "";
    this._token = token;
    if (tokenType) {
        this._tokenType = tokenType;
    }
}
get token() {
    return this._token;
}
set token(value) {
    this._token = value;
}
get tokenType() {
    return this._tokenType;
}
set tokenType(value) {
    this._tokenType = value;
}}

我添加了rxjs-compatnpm 模块来支持 Angular 6+。

为 IE 11 尝试了以下修复:

uncommented polyfills.ts

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/Using-msal.js-with-Internet-Explorer

4

4 回答 4

3

此修复程序目前正在为我工​​作。

问题: NPM 包中的 dist 文件夹(@azure\msal-angular\dist)@azure/msal-angular针对 IE11 编译不正确。

修复:重新 编译 ts 文件 ( https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular) 并添加到您的项目中node_modules\@azure\msal-angular\dist

脚步

  1. 克隆和 npm 安装https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular
  2. npm 运行build:modules
  3. 复制新创建的文件lib-es6
  4. 将文件粘贴lib-es6到您的角度项目node_modules\@azure\msal-angular\dist

npm start你的角度项目。

于 2018-11-09T21:14:46.843 回答
0

有一个 msal npm 包,其工作原理基本相同。我在我的 Angular 7 应用程序中使用它。

于 2018-11-08T19:55:14.253 回答
0

根据这个图书馆的文件。这仅在 Angular(4.3-5) 中受支持。不支持 Angular 6 或 7。您需要等待支持 Angular 7 的版本。

参考:- https://www.npmjs.com/package/@azure/msal-angular

Angular 的 MSAL 库预览版是核心 MSAL.js 库的包装器,它使Angular(4.3 到 5)应用程序能够使用 Microsoft Azure Active Directory (AAD)、Microsoft 帐户用户 (MSA)、使用社交身份提供程序的用户对企业用户进行身份验证像 Facebook、Google、LinkedIn 等,并可以访问 Microsoft Cloud 或 Microsoft Graph。

于 2019-08-14T06:21:35.243 回答
0

这是一个众所周知的错误,开发人员计划在2019 年 7 月至 2019 年 9 月左右在他们即将发布的 @azure/msal-angular 1.0 版中修复该错误。

资料来源:

于 2019-06-17T14:34:21.717 回答