I'm using the php-upwork-oauth2 package and symfony to get my upwork profile information.
Based on this repository: https://github.com/upwork/php-upwork-oauth2/blob/master/example/example.php I added my clientId and clientSecret:
$config = new \Upwork\API\Config([ 'clientId' => '...', // SETUP YOUR CONSUMER KEY 'clientSecret' => '...', // SETUP KEY SECRET 'redirectUri' => 'https://localhost:8000/upwork', 'accessToken' => $session->get('access_token'), 'accessSecret' => $session->get('access_secret'), //'expiresIn' => 'xxxxxxxxxx', // WARNING: keep this up-to-date! 'debug' => true, // enables debug mode //'authType' => 'MyOAuthPHPLib' // your own authentication type, see AuthTypes directory ]); $client = new \Upwork\API\Client($config); $auth = new \Upwork\API\Routers\Auth($client); $info = $auth->getUserInfo(); dd($info);
How to obtain accessToken and accessSecret?
I'm currently getting this error:
Call the member function getBody() on the string
What is
$session->get('access_token'),
in the code? Is something set? I recommend:accessToken
andaccessSecret
lines