Easier token issuing and authentication
We're happy to announce that ActiveCollab API wrapper for PHP is hitting version 3.0, bringing easier token issuing and authentication.
There are now two authenticators that make the authentication a lot easier. To grab a token for one of your ActiveCollab Cloud accounts, you should use Cloud authenticator:
$authenticator = new \ActiveCollab\SDK\Authenticator\Cloud('ACME Inc', 'My Awesome Application', 'firstname.lastname@example.org', 'hard to guess, easy to remember');
// Show all ActiveCollab 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 ActiveCollab setups:
// Construct a self-hosted authenticator. Last parameter is URL where your ActiveCollab is installed
$authenticator = new \ActiveCollab\SDK\Authenticator \SelfHosted('ACME Inc', 'My Awesome Application', 'email@example.com', 'hard to guess, easy to remember', 'https://my.company.com/projects');
// 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.