Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
419 views
in Technique[技术] by (71.8m points)

php - Connecting to ActiveCollab by SDK throws an error

I'm trying to connect to our cloud account, but I get the following error:

Fatal error: Uncaught Error: Class 'ActiveCollabSDKAuthenticatorCloud' not found in /www/htdocs/asdf/asdf.org/example-cloud.php:13 Stack trace: #0 {main} thrown in /www/htdocs/asf/asdf.org/example-cloud.php on line 13

    require_once('https://app.activecollab.com/xxxxxx/autoload.php');

// Provide name of your company, name of the app that you are developing, your email address and password.
$authenticator = new ActiveCollabSDKAuthenticatorCloud('xxx', 'My Awesome Application', '[email protected]', '123qwe123*');

// Show all Active Collab 5 and up account that this user has access to.
print_r($authenticator->getAccounts());

// Show user details (first name, last name and avatar URL).
print_r($authenticator->getUser());

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

// Did we get it?
if ($token instanceof ActiveCollabSDKTokenInterface) {
    print $token->getUrl() . "
";
    print $token->getToken() . "
";
} else {
    print "Invalid response
";
    die();
}

What did I wrong?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First line in your code example is not good. You should check the article on basic usage of Composer prior to continuing: https://getcomposer.org/doc/01-basic-usage.md

Once you have properly set up Composer in your development environment, required ActiveCollab SDK, and updated dependencies, your first line will most probably look like this:

require __DIR__ . '/vendor/autoload.php';

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

62 comments

56.6k users

...