我正在使用 php-upwork-oauth2 包和 symfony 來獲取我的 upwork 配置文件信息。
基于此存儲庫:https://github.com/upwork/php-upwork-oauth2/blob/master/example/example.php 我添加了我的 clientId 和 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);
如何獲取 accessToken 和 accessSecret ?
我目前收到此錯誤:
調(diào)用字符串上的成員函數(shù) getBody()
代碼中的 $session->get('access_token'),
是什么?是否設(shè)置了某些內(nèi)容?
我建議:
accessToken
和 accessSecret
行