Skip to main content
Question

Grant credentials are invalid

  • May 22, 2025
  • 11 replies
  • 52 views

Forum|alt.badge.img

Sorry for posting about this as I understand there have been multiple threads regarding this in the past. I remember reading there was a bug though I am not sure if it has been fixed.

 

The error is

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

 

My client ID is - y8mb0api5yuxigwwnqsqsr3ex3at5tdm

App access level is - App only access

Authentication method is - OAuth 2.0 with Client Credentials Grant (Server Authentication)

 

If possible, could someone please check if things are working as they should in the back end?

 

Thank you so much for helping.

 

11 replies

Forum|alt.badge.img

We will check and report back. 

Thanks,

Alex, Box Developer Advocate


Forum|alt.badge.img

Hello, 

The bug that was causing issues with Client Credentials Grant was resolved, but I did double check the backend and it looks fine for this application. 

Can you please share the call you're making (redact the client secret)? Also, please double check that you're passing using one of the below: 

  • box_subject_type = enterprise and box_subject_id=YOUR_ENTERPRISE_ID_HERE
  • box_subject_type = user and box_subject_id = APP_USER_ ID_HERE; you cannot pass your own user ID or a managed user ID 

 Best,

Kourtney, Box Developer Advocate


Forum|alt.badge.img

I’m trying to gain access through a cURL request via bash:

 

curl --location --request POST "https://api.box.com/oauth2/token" \ 
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "client_id=y8mb0api5yuxigwwnqsqsr3ex3at5tdm" \
--data-urlencode "client_secret=redacted" \
--data-urlencode "grant_type=client_credentials" \
--data-urlencode "box_subject_type=user" \
--data-urlencode "box_subject_id=1*******4"

I get the error mentioning that my grant credentials are invalid. I’m following the guidelines mentioned

Thank you for helping.


Forum|alt.badge.img

I believe you're trying to pass your own user ID into the box_subject_id, which won't work because you've selected app only as the application access. This setting means you'll only be able to pass the user ID of the app's service account or any app users. If you want to be able to use your own user ID you'll need to change to app+enterprise and then reauthorize the app in the admin console. 


Forum|alt.badge.img

It worked! Thank you so much for helping and sorry for being such a bother.


Forum|alt.badge.img

Wonderful to hear and definitely not a bother! This helped me update our documentation to help others in the future :) 


Forum|alt.badge.img

Hi All,

Getting "Grant credentials are invalid" error.

Client ID : 0ahcovdzholujrpt39uh42r95i6i979m

App access level is - App only access

Authentication method is - OAuth 2.0 with Client Credentials Grant (Server Authentication)

I also wanted to ask one thing that the app which I have created ia not authorized by the box Admin. Is this why I am getting this error. Please help ASAP.

Thanks in advance.

 


Forum|alt.badge.img

I seem to have the same issue...!


Forum|alt.badge.img

Hi 23426911768,

 

I am facing same issue

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

 

my client id: 

 

curl -i -X POST "https://api.box.com/oauth2/token" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "client_id=laxwqvlbbb61zkz7oj1np4d2dvsy8fes" \
     -d "client_secret=********" \
     -d "grant_type=client_credentials" \
     -d "box_subject_type=user"  \
     -d "box_subject_id=2473***36"

 

Access: App+Enterprise level

 

Also tried both app and app+enterprise but both option not worked. Can you please provide suggestion on this?

 

Thank you

Govindh


Forum|alt.badge.img

Hello,

I'm facing the same issue. I'm trying to use a .net application to access Box according to this guide  , but when I run it , will appear "Box.V2.Core: The API returned an error [BadRequest] invalid_grant - Grant credentials are invalid." . For the App Access Level I'm using "App + Enterprise Access" . My code is in following part. could you provide some help? 

                var boxConfig = new BoxConfigBuilder("MyclientID", "MysecretID")
                .SetEnterpriseId("MyEnterpriseID")
                .Build();
                var boxCCG = new BoxCCGAuth(boxConfig);
               var adminToken = await boxCCG.AdminTokenAsync();

 

Best Regards,

Eden


Forum|alt.badge.img

Same here: nx5hjy62mrunmuqkk4dcvtwvad578kvl