docusign / docusign-esign-php-client

The Official Docusign PHP Client Library used to interact with the eSign REST API. Send, sign, and approve documents using this client.
https://www.docusign.com/devcenter
MIT License
198 stars 122 forks source link

ApiClient refreshAccessToken throw ApiException with code 400 #171

Closed unicorn610 closed 2 years ago

unicorn610 commented 2 years ago

I call the refreshAccessToken method with client_id, client_secret, refresh_token, but get 400 code of response. After failing, I successfully using same value to get new token by postman.

The error message is "Error while requesting server, received a non successful HTTP code [400] with response Body: O:8:"stdClass":1:{s:5:"error";s:15:"invalid_request";}"

karankaushik95 commented 2 years ago

Hey, this sounds like it could use a bit more investigation. Could you open a support ticket with us: https://support.docusign.com/s/contactSupport?language=en_US&rsc_301 so my developer support team can investigate this further?

unicorn610 commented 2 years ago

Hi, is the support only for paid customer? My developer account cannot login the support system. Currently, I'm helping my client to verify could this product meet their requirement.

karankaushik95 commented 2 years ago

Hey - no not at all

On the page I linked, there's a tab for DocuSign API Integration Support with a form in it. If you fill that out, it will get sent to us.

unicorn610 commented 2 years ago

After testing, I found the refresh token API (/oauth/token) only accept form-data but the method refreshAccessToken in ApiClient uses x-www-form-urlencoded. That's might be the reason why I got error [400] response. I got [200] response after I remove the 'Content-Type' => 'application/x-www-form-urlencoded'. FYR.

$headers = [ 
    "Authorization" => $integrator_and_secret_key, 
    "Content-Type" => "application/x-www-form-urlencoded", 
];