From 1f61cf8a9bcb6b2eacaf6d63ff1d2a4b97b13e9f Mon Sep 17 00:00:00 2001 From: Kinta mahadji Date: Tue, 25 Jan 2022 21:31:10 +0700 Subject: [PATCH 1/2] Update BasecampClient.php Update endpoint of basecamp 3 api --- src/Basecamp/BasecampClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Basecamp/BasecampClient.php b/src/Basecamp/BasecampClient.php index 099b998..94f8ae9 100755 --- a/src/Basecamp/BasecampClient.php +++ b/src/Basecamp/BasecampClient.php @@ -26,7 +26,7 @@ class BasecampClient extends Client public static function factory($config = array()) { $default = array( - 'base_url' => 'https://basecamp.com/{user_id}/api/{version}/', + 'base_url' => 'https://3.basecampapi.com/{user_id}/', 'version' => 'v1', 'auth' => 'http', 'token' => null, From 351d2557c2b40dbd315a5a0d3489e1a251e463ba Mon Sep 17 00:00:00 2001 From: Kinta mahadji Date: Tue, 25 Jan 2022 21:51:35 +0700 Subject: [PATCH 2/2] Update BasecampClient.php Remove Basic authentication, this is from https://github.com/basecamp/bc3-api --- src/Basecamp/BasecampClient.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/Basecamp/BasecampClient.php b/src/Basecamp/BasecampClient.php index 94f8ae9..61165e6 100755 --- a/src/Basecamp/BasecampClient.php +++ b/src/Basecamp/BasecampClient.php @@ -27,28 +27,18 @@ public static function factory($config = array()) { $default = array( 'base_url' => 'https://3.basecampapi.com/{user_id}/', - 'version' => 'v1', - 'auth' => 'http', 'token' => null, - 'username' => null, - 'password' => null, ); $required = array('user_id', 'app_name', 'app_contact'); $config = Collection::fromConfig($config, $default, $required); $client = new self($config->get('base_url'), $config); - if ($config['auth'] === 'http') { - if (! isset($config['username'], $config['password'])) { - throw new InvalidArgumentException("Config must contain username and password when using http auth"); - } - $authorization = 'Basic ' . base64_encode($config['username'] . ':' . $config['password']); - } - if ($config['auth'] === 'oauth') { - if (! isset($config['token'])) { - throw new InvalidArgumentException("Config must contain token when using oauth"); - } - $authorization = sprintf('Bearer %s', $config['token']); + + if (! isset($config['token'])) { + throw new InvalidArgumentException("Config must contain token when using oauth"); } + $authorization = sprintf('Bearer %s', $config['token']); + if (! isset($authorization)) { throw new InvalidArgumentException("Config must contain valid authentication method"); }