baileyherbert / envato.php

🍂 Composer package for the Envato API.
https://packagist.org/packages/baileyherbert/envato
38 stars 23 forks source link

Error while creating new client #11

Closed fastesol closed 4 years ago

fastesol commented 5 years ago

Hi, first of all thank you for the wonderful sdk. Well, I tried using the sdk but got the following error (after delegating access from Envato).

This is the Line # 21 $client = new Herbert\EnvatoClient($token);

Here is the Error Fatal error: Uncaught TypeError: Argument 1 passed to Herbert\EnvatoClient::__construct() must implement interface Herbert\Envato\Auth\AuthProcedure, string given, called in /xxxx/xxxx/example.com/api/envato/index.php on line 21 and defined in /xxxx/xxxx/example.com/api/envato/vendor/baileyherbert/envato/src/EnvatoClient.php:44 Stack trace: #0 /xxxx/xxxx/example.com/api/envato/index.php(21): Herbert\EnvatoClient->__construct('1EDetvr5cIFNNHU...') #1 {main} thrown in /xxxx/xxxx/example.com/api/envato/vendor/baileyherbert/envato/src/EnvatoClient.php on line 44

Patchesoft commented 5 years ago

Looks like they forgot to update the example code for oauth code.

Change Client line to:

$client = new Herbert\EnvatoClient(new Herbert\Envato\Auth\Token($oauth->token));