Skip to main content
Question

Error: Grant credentials are invalid

  • May 22, 2025
  • 55 replies
  • 107 views

Forum|alt.badge.img

Hi,

I have created a Client Grant type application in our company Box application.

When trying to connect to it, I am getting following error:

curl -L -X POST "https://<companyboxurl>/oauth2/token"
-H "Content-Type: application/x-www-form-urlencoded"
--data-urlencode "client_id=<client_id>"
--data-urlencode "client_secret=<client_secret>"
--data-urlencode "grant_type=client_credentials"
--data-urlencode "box_subject_type=enterprise"
--data-urlencode "box_subject_id=<enterprise_id>"

On trying this, I am getting the below error:

{"error":"invalid_grant","error_description":"Grant credentials are invalid"}

Can you please let me know, what I might be missing.

 

 

 

 

55 replies

Forum|alt.badge.img

Hello, 

Could you please provide the client ID of your application so I can take a look at it in the backend? I believe you may be affected by a known bug. 

Best,

Kourtney, Box Developer Advocate


Forum|alt.badge.img

Hi Kourtney,

Thank you for replying.

Here is the client Id: pult3u3k5hfw0h22o1azb01jh0oi9qxc

I am trying my test on Sandbox environment of Box.


Forum|alt.badge.img

Hey Rathin, 

Thank you for providing that information! It does appear this is the bug at work, but I can quickly help you work around it. Can you please tell me what the desired application access is for this app (i.e. app only or app + enterprise)? 

Best,

Kourtney, Box Developer Advocate


Forum|alt.badge.img

Hi Kourtney,

Thanks for quick response.

I am building a backend application, which will be uploading some files to box folders using BOX API. The application will have no access to website or redirect url.

So achieve this, I am trying the option of client grant, using client id and client secret.


Forum|alt.badge.img

Hi Rathin,

I stumbled upon this issue while researching something for another. What kind of app did you initially set up? Did you do the limited access app or the full enterprise app?

Jamie


Forum|alt.badge.img

Hey Rathin, 

Apologies my question was not clear enough-- which option under the configuration tab did you want set for the application access? The options are either app only or app + enterprise. The bug is affecting the selection not being flagged on the backend which is why you are getting this error. 

Best,

Kourtney


Forum|alt.badge.img

Thanks for replying.

@Kourtney, I am using App Only setting.

@Jamie, I have selected Custom App and then Server Authentication


Forum|alt.badge.img

Thank you --- go ahead and try to authenticate now! Things should be working. 


Forum|alt.badge.img

Hi - I'm having this same issue. How was this resolved?


Forum|alt.badge.img

Hey Eric -- Can you please provide me with your application's client ID and which option under the configuration tab you want set for the application access. The options are either app only or app + enterprise.

Best,

Kourtney, Box Developer Advocate


Forum|alt.badge.img

@Kourtney - Client ID: c91l0lqu7q0c3vdn8gtjxp8serrdo91k and configuration is app access only. Thanks.


Forum|alt.badge.img

Hi Kourtney,

I am able to access the API successfully. My Box application was not approved by Admin, due to which authorization was failing.

Thanks for looking into this.


Forum|alt.badge.img

Hi,
I have the same problem, what is the source of the problem and how could I fix it?

We selected custom app with server authentifcation(client credentials) and app access only. 

Thanks,

 


Forum|alt.badge.img

Hello @N'Diaye Ousmane: 

Apologies for the delay. Your application should now be able to be used. Please reauthorize the app in the admin console and try again! 


Forum|alt.badge.img

Hi Kourtney,

Having the same issue.

Auth Method: OAuth 2.0 w/ JWT

Client_ID: ev07ia8ox3986pabq74vt8cft35pzdt0

App Access Level: App + Enterprise Access


Forum|alt.badge.img

Hey Stephen, 

If you want to use client id + client secret to authenticate you will need to make another app with the auth method as server authentication (with client credentials grant). This will not work with the current setup! 

Best,

Kourtney


Forum|alt.badge.img

Hi Kourtney,

I have the same problem on my sandbox environment.
How can I fix it?
client_id: t90sdo91qdb4dc81tw36ujr4eq5bmgy8

Thank you,


Forum|alt.badge.img

Hello @Hirosuke,

Happy to help you out here. Can you please tell me what you tried to select for application access in the Developer Console?  The options are app only access or app + enterprise access? 

Best,

Kourtney


Forum|alt.badge.img

Hello Kourtney,

Thank you for your quick reply.
I selected "App Access Only".


Forum|alt.badge.img

Hello @Kourtney. I set the initial configuration to OAuth 2.0 with Client Credentials Grant (Server Authentication)

My app's clientId is: o0dlrw040lfrmz8d9jv3kcoa77xdzuex. I have set the application access to App + Enterprise Access. I hope that's everything you need. Thank you!


Forum|alt.badge.img

Hello @Kourtney. My initial configuration is the Client Credentials Grant (Server Authentification) 

 

My app's client id is kzd2wtczdmn178kdgsqfvgvmqve006qr and I have the App + Enterprise Access. Can you please enable permission. I keep receiving the "Grant credentials are invalid"


Forum|alt.badge.img

I was able to get this working using the Authorization Code flow, but when I try using Client Credentials, I'm able to get an access token but using it results in a 404 Error. Do I need to request enterprise access even though my workplace has an enterprise account? I ask because if I were to try and use a console application to ultimately do what we need, my best bet is likely to convert my Authorization Code function into a web service the Console application can call in order to successfully make an API call itself.


Forum|alt.badge.img

@Hirosuke: Thank you for confirming! Please reauthorize your app in the admin console and try again now. 

@Ruben: This is already selected appropriately on the backend so there seems to be another issue with your request. Can you please confirm that the client id and client secret you're sending are correct and associated with the same application? 

@Arturo: This authentication type will obtain a token for the application's service account. A 404 indicates that the user associated with your access token does not have access to the content you're trying to call. If you're not sure who your access token is associated with you can use the get current user endpoint. You will either need to obtain an access token for a user that already has access to the content or collaborate in your service account to the content. 


Forum|alt.badge.img

Hi, I am getting this issue {"error":"invalid_client","error_description":"The client credentials are invalid"}, after passing the correct credentials

Could you please take a look...


Forum|alt.badge.img

Hello @namrata: 

Can you please provide the client ID of your application and what you tried to select for application access in the Developer Console?  The options are app only access or app + enterprise access.