0

I'm using php-upwork-oauth2 package with symfony to get my upwork profile informations .

Based on this repository : https://github.com/upwork/php-upwork-oauth2/blob/master/example/example.php i added my clientId and my 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 can i get accessToken and accessSecret ?

I'm currently getting this error :

Call to a member function getBody() on string

Khaled Boussoffara
  • 1,567
  • 2
  • 25
  • 53

1 Answers1

0

What is $session->get('access_token'), in your code? Is it set to something? I'd recommend:

  1. comment out accessToken and accessSecret lines
  2. follow the authentication and authorization process
  3. grep received access token/secret
  4. add the token pair to the config
mnovozhylov
  • 311
  • 1
  • 3