Skip to main content
Participating Frequently
Sep 22, 2023 1:52 PM UTC
Solved

Client Credentials Grant User ID Access_token failed

I would like to obtain Access_Token through ‘Client Credentials Grant’.

I created a New App through the My Apps menu.

Administrator approval was obtained through the Authorization tab.

When I request authentication as follows, an error message appears.

https://api.box.com/oauth2/token
grant_type: client_credentials
client_id: xd~~
client_secret: Tm~~
box_subject_type: user
box_subject_id: 28~~

response)
{
“error”: “invalid_grant”,
“error_description”: “Grant credentials are invalid”
}

I requested the API through ‘Postman’.

Help me please~
Thanks.

    Participating Frequently
    Sep 26, 2023 6:28 AM UTC

    Hello,

    I was able to get the Access_token after selecting the above option and authenticating to the administrator again.

    Thanks.

    9 replies

    smartoneinok Box
    Senior Developer Advocate
    Sep 22, 2023 3:19 PM UTC

    Hello 👋,

    This is probably because of the issues described in the common errors section of our documentation. Depending on what access levels you set up for your application change the parameters you need to send in with the request.

    Thanks,
    Alex, Box Developer Advocate 🥑

    Translate
    Participating Frequently
    Sep 23, 2023 2:37 AM UTC

    Hello~
    In the above parameters, applying for access_token with enterprise ID was successful, but applying with user ID failed.
    Is there anything else I need to do in the Custom App?
    Thanks.

    Translate
    Participating Frequently
    Sep 23, 2023 2:24 PM UTC

    Is this option related to requesting Access_Token for User ID?

    Translate
    smartoneinok Box
    Senior Developer Advocate
    Sep 25, 2023 7:45 PM UTC

    Yes, you will need to check that box labeled - generate user access tokens… make sure to reauthorize after you do this.

    Translate
    smartoneinok Box
    Senior Developer Advocate
    Sep 25, 2023 7:54 PM UTC

    Correction - you just need the one box for generate user access tokens…not both

    Translate
    converselabelsAuthorAnswer
    Participating Frequently
    Sep 26, 2023 6:28 AM UTC

    Hello,

    I was able to get the Access_token after selecting the above option and authenticating to the administrator again.

    Thanks.

    Translate
    Oct 3, 2023 1:03 PM UTC

    Hi, I have created an app and my app is authorized but on making api request I am not able to retrieve the files in the box, it is giving only the app details.
    I’m passing subject type as enterprise and subject id and in the Application scope I have selected “Make API calls using the as-user header”, with this Iam getting access token but this token is giving only the app details not the folder/files details. Can you please help me in retrieving the box folders/files. Thanks

    Translate
    Participating Frequently
    Oct 4, 2023 8:38 AM UTC

    Try requesting the access_token with the User ID, not the enterprise ID.

    Translate
    Oct 4, 2023 2:01 PM UTC

    I am able to retrieve the files using user id. Thanks for the help!

    Translate