was expecting a method to get token from refresh_token and didn't find one. I have added a method to ApiClient locally and that worked for me. Here is the definition
docusign-php-client/src/Client/ApiClient.php
public function refreshAccessToken($client_id = null, $client_secret = null, $code = null){ if (!$client_id) { throw new \InvalidArgumentException('Missing the required parameter $client_id when calling refreshAccessToken'); } if (!$client_secret || !$code) { throw new \InvalidArgumentException('Missing the required parameter $client_secret when calling refreshAccessToken'); } if (!$code) { throw new \InvalidArgumentException('Missing the required parameter $code when calling refreshAccessToken'); }$resourcePath = "/oauth/token"; $queryParams = []; $integrator_and_secret_key = "Basic " . utf8_decode(base64_encode("{$client_id}:{$client_secret}")); $headers = [ "Authorization" => $integrator_and_secret_key, "Content-Type" => "application/x-www-form-urlencoded", ];$postData = [ "grant_type" => "refresh_token", "refresh_token" => $code, ];list($response, $statusCode, $httpHeader) = $this->callApi($resourcePath, self::$POST, $queryParams, $postData, $headers, null, null, true);if (isset($response->access_token)) { $this->config->addDefaultHeader("Authorization", "{$response->token_type} {$response->access_token}"); } return [$this->getSerializer()->deserialize($response, '\DocuSign\eSign\Client\Auth\OAuthToken', $httpHeader), $statusCode, $httpHeader]; }
Hi Team,
was expecting a method to get token from refresh_token and didn't find one. I have added a method to ApiClient locally and that worked for me. Here is the definition
docusign-php-client/src/Client/ApiClient.php
public function refreshAccessToken($client_id = null, $client_secret = null, $code = null)
{ if (!$client_id) { throw new \InvalidArgumentException('Missing the required parameter $client_id when calling refreshAccessToken'); } if (!$client_secret || !$code) { throw new \InvalidArgumentException('Missing the required parameter $client_secret when calling refreshAccessToken'); } if (!$code) { throw new \InvalidArgumentException('Missing the required parameter $code when calling refreshAccessToken'); }
$resourcePath = "/oauth/token"; $queryParams = []; $integrator_and_secret_key = "Basic " . utf8_decode(base64_encode("{$client_id}:{$client_secret}")); $headers = [ "Authorization" => $integrator_and_secret_key, "Content-Type" => "application/x-www-form-urlencoded", ];
$postData = [ "grant_type" => "refresh_token", "refresh_token" => $code, ];
list($response, $statusCode, $httpHeader) = $this->callApi($resourcePath, self::$POST, $queryParams, $postData, $headers, null, null, true);
if (isset($response->access_token)) { $this->config->addDefaultHeader("Authorization", "{$response->token_type} {$response->access_token}"); } return [$this->getSerializer()->deserialize($response, '\DocuSign\eSign\Client\Auth\OAuthToken', $httpHeader), $statusCode, $httpHeader]; }