Skip to main content
Question

Getting this error => The client credentials are invalid

  • May 22, 2025
  • 3 replies
  • 22 views

Forum|alt.badge.img

$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;

3 replies

Forum|alt.badge.img

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 


Forum|alt.badge.img

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


Forum|alt.badge.img

Can you try reauthorizing your application in the Admin console?