我正在使用 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 ?
我目前收到此错误:
调用字符串上的成员函数 getBody()
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
代码中的
$session->get('access_token'),是什么?是否设置了某些内容? 我建议:accessToken和accessSecret行