I want to get the user info (and user id in particular) after having my user go through the OAuth flow.
I try to obtain an access code from the return "code" queryparameter, but I get an "unauthorized_client" error
Here is my relevant code:
$url = 'https://account.docusign.com/oauth/token';
$cURLConnection = curl_init($url);
curl_setopt($cURLConnection, CURLOPT_URL, $url);
curl_setopt($cURLConnection, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);
//create basic authorization
$integration_key = '...2dee';
$secret_key = '...c11a';
$headers = array(
"Authorization: Basic " . base64_encode($integration_key . ':' . $secret_key)
);
curl_setopt($cURLConnection, CURLOPT_HTTPHEADER, $headers);
$body = array(
"grant_type" => "authorization_code",
"code" => $_REQUEST['code']
);
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $body);
$access_token = json_decode(curl_exec($cURLConnection), true);
print_r($access_token);
The error is provided by the print_r of $access_token
Thanks!