add IAM connection parameters

merge-requests/25/merge
Matthew 2021-06-04 22:55:10 -04:00
parent 64d1224a36
commit 86f6f8886f
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 13 additions and 0 deletions

View File

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