From 86f6f8886f7cbe592f2cdae69f71b7fec2d27e8a Mon Sep 17 00:00:00 2001 From: Matthew R Date: Fri, 4 Jun 2021 22:55:10 -0400 Subject: [PATCH] add IAM connection parameters --- src/class/Util.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/class/Util.ts b/src/class/Util.ts index 2b41975..4f44c8f 100644 --- a/src/class/Util.ts +++ b/src/class/Util.ts @@ -1,4 +1,5 @@ /* eslint-disable no-bitwise */ +import auth0 from 'auth0'; import axios from 'axios'; import nodemailer from 'nodemailer'; import childProcess from 'child_process'; @@ -21,6 +22,8 @@ export default class Util { public report: Report; + public authClient: auth0.ManagementClient; + constructor(client: Client) { this.client = client; this.moderation = new Moderation(this.client); @@ -37,6 +40,7 @@ export default class Util { }); this.pbx = new PBX(this.client); this.report = new Report(this.client); + this.authClient = this.getManagementClient(); } get emojis() { @@ -47,6 +51,15 @@ export default class Util { }; } + protected getManagementClient() { + return new auth0.ManagementClient({ + audience: 'https://libraryofcode.us.auth0.com/api/v2/', + domain: 'auth.libraryofcode.org', + clientId: this.client.config.auth0ClientID, + clientSecret: this.client.config.auth0ClientSecret, + }); + } + public async addUserToMailingList(email: string, list: string) { try { const { data } = await axios({