Skip to content

Commit d297fcf

Browse files
authored
Merge pull request #28 from carro-public/feat-support-twilio-api-keys
Allows authentication using API key/secret
2 parents 1a36af4 + 9317e84 commit d297fcf

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/Senders/TwilioSender.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ class TwilioSender extends Sender
2626
public function __construct($config, Dispatcher $events, $logger)
2727
{
2828
parent::__construct($config, $events, $logger);
29-
if (empty($config['account_sid']) || empty($config['auth_token'])) {
30-
throw new InvalidArgumentException('Missing account_sid or auth_token for TwilioSender in config/notifications.php');
29+
30+
$hasClassicAuth = !empty($config['account_sid']) && !empty($config['auth_token']);
31+
$hasApiKeyAuth = !empty($config['account_sid']) && !empty($config['api_key']) && !empty($config['api_secret']);
32+
33+
if (!$hasClassicAuth && !$hasApiKeyAuth) {
34+
throw new InvalidArgumentException(
35+
'Invalid TwilioSender config: Provide either account_sid + auth_token, or account_sid + api_key + api_secret in config/notifications.php'
36+
);
3137
}
3238

3339
if (isset($config['api_key'])) {

0 commit comments

Comments
 (0)