Skip to main content

$access_token_url = "https://api.box.com/oauth2/token";
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $access_token_url);
curl_setopt($ch,CURLOPT_HTTPHEADER, array(
"Content-Type: application/x-www-form-urlencoded"
));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);


curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'client_id' => 'a03qmxnzano36zkylmyx70wxgvx732ui',
'client_secret' => 'REDACTED',
'grant_type' => 'client_credentials'
]));

$response = curl_exec($ch);
curl_close($ch);
return $response;

Hello Sehar, 


It looks like you're missing `box_subject_type` and `box_subject_id`. Please follow the cURL sample here: 


https://developer.box.com/guides/authentication/client-credentials


Best,


Kourtney, Box Developer Advocate 


I have given that as well, but i keep getting the same error.


Can you try reauthorizing your application in the Admin console?


Reply