Active Collab API Wrapper 3.0

Easier token issuing and authentication

· labs


We’re happy to announce that Active Collab API wrapper for PHP is hitting version 3.0, bringing easier token issuing and authentication.

Token issuing

There are now two authenticators that make the authentication a lot easier. To grab a token for one of your Active Collab Cloud accounts, you should use Cloud authenticator:

require_once '/path/to/vendor/autoload.php';

$authenticator = new \ActiveCollab\SDK\Authenticator\Cloud('ACME Inc', 'My Awesome Application', '', 'hard to guess, easy to remember');

// Show all Active Collab 5 and up account that this user has access to 

// Show user details (first name, last name and avatar URL) 

// Issue a token for account #123456789 
$token = $authenticator->issueToken(123456789);

There’s also an authenticator for self-hosted Active Collab setups:

require_once '/path/to/vendor/autoload.php';

// Construct a self-hosted authenticator. Last parameter is URL where your Active Collab is installed
$authenticator = new \ActiveCollab\SDK\Authenticator \SelfHosted('ACME Inc', 'My Awesome Application', '', 'hard to guess, easy to remember', '');

// Issue a token
$token = $authenticator->issueToken();

Making API requests

Once you get the token, you can create a client and make API requests:

$client = new \ActiveCollab\SDK\Client($token);

Note that $token here is not a string, but an object that has both API URL and the token in it, so you should store both values if you want to reuse it later on:

// Create token using saved token and URL
$token_from_settings = new \ActiveCollab\SDK\Token('...', '...');
$client = new \ActiveCollab\SDK\Client($token_from_settings);

Our development team hopes you'll find these changes helpful and so you can create some interesting integrations and add-ons.

If you have any questions about API SDK or how to use it, raise a GitHub issue or create a Stack Overflow question and tag it with activecollab tag, and we'll do our best to help you.

Share this article
Related Articles

Powerful, yet simple project management

Active Collab helps your team stay organized when you outgrow email. But it’s so much more than that — with plenty of neat add-ons, it’s a one-stop solution for all your business needs.

Find out more