I am using the box api as mentioned in the documentation. I get the ticket from api_key and then auth_token from api_key and ticket.
But when i use this auth_token for getting information like folder list or file contents etc. I get unauthorized error in response.
Here is my code:
$auth_token = $_REQUEST["auth_token"];
//exit($auth_token);
$headers = array(
"Authorization: BoxAuth api_key=".$box_api_key."&auth_token=".$auth_token
);
$http_message = curl_init("https://www.box.com/api/2.0/folders/0");
curl_setopt($http_message, CURLOPT_RETURNTRANSFER, true);
curl_setopt($http_message, CURLOPT_HTTP_VERSION, "CURL_HTTP_VERSION_1_1");
curl_setopt($http_message, CURLOPT_HTTPHEADER, $headers);
curl_setopt($http_message, CURLINFO_HEADER, true);
curl_setopt($http_message, CURLINFO_HEADER_OUT, true);
curl_setopt($http_message, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($http_message);
print($response);
What may be the problem in the code?
Thanks! Thank you very much in advance!!!