如何将 Auth0 添加到 Angular 中的构建系统?

How do I add to Auth0 to the build system in Angular?

我正在关注 Getting Started tutorial 和 Auth0 for Angular,但我不太确定特定指令的哪一部分是什么意思:

Once you install auth0.js, add it to your build system or bring it in to your project with a script tag.

我刚刚开始使用 Angular 和 Auth0,所以我认为这是一项相当微不足道的任务,但我似乎找不到任何关于如何具体执行此操作的信息。我对捆绑服务有点熟悉,我很确定这就是所涉及的。但是从那里,我不确定涉及哪些文件。

我从 Angular-cli 全新安装了 Angular,并使用

安装了 auth0
npm install --save auth0-js

Once you install auth0.js, add it to your build system or bring it in to your project with a script tag.

含义:您可以添加:

<script type="text/javascript" src="node_modules/auth0-js/build/auth0.js"></script>

<script src="https://cdn.auth0.com/js/auth0/8.10.1/auth0.min.js"></script>  

到位于项目文件夹中的 index.html 页面:

  • 来源
    • 应用程序
    • 资产
    • 环境
    • index.html

或将其添加到您的

从@Andresson 的 link 看来,将其添加到构建系统的方法似乎是在 .angular-cli.json scripts 属性 下的文件。我需要添加以下内容并且似乎得到了预期的结果

  "scripts": [
    "../node_modules/auth0-js/build/auth0.js"
  ]