Skip to main content
Question

Using Coldfusion CFHTTP to get an ACCESS_TOKEN for DIR listings

  • May 22, 2025
  • 1 reply
  • 29 views

Forum|alt.badge.img

Hello -

I am looking to check the a BOX folder every 30 minutes and get the most recent files' metadata to store in our database (if not already there).

First step is to get an "Authorization: Bearer ACCESS_TOKEN". This is ColdFusion code (with the correct client_id & client_secret)  I am trying along with the results.

Code:

<cfhttp method="POST" url="https://api.box.com/oauth2/token" result="login_request">
	<cfhttpparam type="header" name="Accept" value="*/*">
	<cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded"/>
	<cfhttpparam type="body" value="client_id=#myClientId#&client_secret=#myClientSecret#&grant_type=authorization_code">
</cfhttp>

Returns the following result:

 

Filecontent {"error":"unauthorized_client","error_description":"The grant type is unauthorized for this client_id"}
Header HTTP/1.1 400 Bad Request Date: Mon, 26 Apr 2021 20:31:56 GMT

 

Thanks in advance,

Mark

1 reply

Forum|alt.badge.img