How to encode consumer key / consumer secret correctly?
Posted: Fri Nov 11, 2016 8:19 pm
Hey,
I have the code:
But i get the error: 401Client identifier is required
How do i encode my consumer key and my consumer secret correctly?
Thanks
I have the code:
Code: Select all
$url = 'https://ops.epo.org/3.1/auth/accesstoken';
$request_headers = array();
$request_headers[] = 'Content-Type: application/x-www-form-urlencoded';
$request_headers[] = 'Authorization: Basic ...(key)...';
$postdata = "grant_type=client_credentials";
$myCurl = curl_init($url);
curl_setopt($myCurl, CURLOPT_HTTPHEADER, $request_headers);
// Pass the post parameters as a naked string
curl_setopt($myCurl, CURLOPT_POSTFIELDS, $postdata);
// Bypass https
curl_setopt($myCurl, CURLOPT_SSL_VERIFYPEER, false);
// Option to Return the Result, rather than just true/false
curl_setopt($myCurl, CURLOPT_RETURNTRANSFER, true);
// Set the request type to POST
curl_setopt($myCurl, CURLOPT_POST, true);
$result = curl_exec($myCurl);
print_r($result);
curl_close($myCurl);
How do i encode my consumer key and my consumer secret correctly?
Thanks