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({