replace twilio connect with account sid/auth token form

This commit is contained in:
m5r
2022-06-09 00:33:19 +02:00
parent c047e169f2
commit e8ba6a63ab
19 changed files with 437 additions and 208 deletions

View File

@ -51,7 +51,7 @@ export const action: ActionFunction = async ({ request }) => {
return new Response(null, { status: 402 });
}
const encryptedAuthToken = phoneNumber?.organization.twilioAccount?.subAccountAuthToken;
const encryptedAuthToken = phoneNumber?.organization.twilioAccount?.authToken;
const authToken = encryptedAuthToken ? decrypt(encryptedAuthToken) : "";
if (
!phoneNumber ||

View File

@ -57,7 +57,7 @@ export const action: ActionFunction = async ({ request }) => {
// if multiple organizations have the same number
// find the organization currently using that phone number
// maybe we shouldn't let that happen by restricting a phone number to one org?
const encryptedAuthToken = phoneNumber.organization.twilioAccount?.subAccountAuthToken;
const encryptedAuthToken = phoneNumber.organization.twilioAccount?.authToken;
const authToken = encryptedAuthToken ? decrypt(encryptedAuthToken) : "";
return twilio.validateRequest(authToken, twilioSignature, smsUrl, body);
});