javascript - 我收到 Auth0 Node 包中无法识别的函数的错误,特别是在其 AuthenticationClient 和 ManagementClient API 中

标签 javascript node.js typescript auth0 nestjs

Here is a picture of the error.

我进入包并找到了确切的函数错误说无法识别

import { Injectable } from '@nestjs/common';
import uuid from 'uuid/v4';
import { AuthenticationClient, ManagementClient } from 'auth0';
import { EnvConfig } from '../my/env/config';

const config = {
  domain: EnvConfig.AUTH0_DOMAIN,
  clientId: EnvConfig.AUTH0_CLIENT_ID,
  clientSecret: EnvConfig.AUTH0_CLIENT_SECRET,
  audience: `https://${EnvConfig.AUTH0_DOMAIN}/api/v2/`,
};

@Injectable()
export class Auth0Service {
  public authenticationClient;
  public managementClient;

  constructor() {
    this.authenticationClient = AuthenticationClient(config);
    this.managementClient = ManagementClient(config);
  }

实例化 AuthenticationClient 和 ManagementClient 时发生错误。我一直在使用样板系统来设置任何第三方服务,并且从未见过无法识别的功能。我尝试重新安装该软件包,但没有成功。

对正在发生的事情有什么想法吗?

提前谢谢您。

最佳答案

事实证明我是盲目的,没有看到我尝试实例化旁边缺少"new"..

(wrong)
this.authenticationClient = AuthenticationClient(config);

(correct)
this.authenticationClient = new AuthenticationClient(config);

关于javascript - 我收到 Auth0 Node 包中无法识别的函数的错误,特别是在其 AuthenticationClient 和 ManagementClient API 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55287264/

相关文章:

javascript - express js事件列表?

javascript - JS : Maximum call stack size exceeded on disconnect despite function being empty

javascript - Typescript:此条件将始终返回 'false',因为类型 'Type' 和 'number' 没有重叠

javascript - 协助使用 Jquery 将一个 div 更改为另一个 div

javascript - 无法读取React中未定义的属性 'bind'

javascript - 使用 jquery mobile 定位链接

node.js - 您如何为用于 GRPC 的 protobuf 文件生成类型?

javascript - Apple Watch网站上的canvas动画是如何实现的?

javascript - 什么时候在 Nodejs 中使用匿名函数?

angular - 将不需要的字段添加到 formBuilder