Skip to main content
Box Employee
May 22, 2025 11:45 AM UTC
Question

Grant credentials are invalid

Hi,

I am getting this error --> {"error":"invalid_grant","error_description":"Grant credentials are invalid"} when I am trying to generate access token using the credentials.

Client id is ni8daktl7chhwxlt0zovndcefq4e7brc

App Access Level is set to App Access Only.

Can anyone please look into this?

Thanks,

Kaustav

    13 replies

    Box Employee
    May 22, 2025 11:45 AM UTC

    Hello, 

    Please go ahead and re-try now! 

    Best, 

    Kourtney, Box Developer Advocate

    Translate
    Box Employee
    May 22, 2025 11:45 AM UTC

    Hi Kourtney,

     

    Thanks for replying. I am still getting the same error for client id ni8daktl7chhwxlt0zovndcefq4e7brc.

    However, I have another app with client id 7ficj01obo62wtckb6lk3t1qtk2u3on6 which works absolutely fine. For both the apps, all the settings and configurations are same however the first one is not working. What can be the issue?

    Translate
    Box Employee
    May 22, 2025 11:45 AM UTC

    Hello, 

    Can you please reauthorize the one that's not working and then retry? 

    Best,

    Kourtney

    Translate
    Box Employee
    May 22, 2025 11:45 AM UTC

    Thanks Kourtney. I will try to get the app reauthorized.

    Translate
    Box Employee
    May 22, 2025 11:45 AM UTC

    Hi Kourtney,

    I have got the app reauthorized. But I am still getting the same error.

    Translate
    Box Employee
    May 22, 2025 11:45 AM UTC

    Redacting your client secret, can you please show me the request you're making? 

    Translate
    Box Employee
    May 22, 2025 11:45 AM UTC

    Hi,

    This is the request I am making:

    type: "POST",
    url: "https://api.box.com/oauth2/token",
    data: {
    contentType:'application/x-www-form-urlencoded',
    client_id: 'ni8daktl7chhwxlt0zovndcefq4e7brc',
    client_secret: 'xxxxxxxxxxxxxxxxxxxx',
    grant_type: 'client_credentials',
    box_subject_type: 'user',
    box_subject_id: 'xxxxxxxxxxx'
    }

    Translate
    Box Employee
    May 22, 2025 11:45 AM UTC

    Hi Kourtney,

    I am getting error while making a request using this client id

    BOX1_y0oUDSramlpH4--jIO03CQ.png

    However, the request is successful while using another client id

    BOX1__BIekUL6le13LBmbh_aJdw.png

    What could be the possible reasons for this? All the configurations in the dev console are similar.

     

     

    Translate
    Box Employee
    May 22, 2025 11:45 AM UTC

    I did some testing and I was able to get client ID ni8daktl7chhwxlt0zovndcefq4e7brc to work when setting the box_subject_id to enterprise. I see the app access is set to app only. Can you confirm that the user ID you're trying to pass is for an app user and not a managed user ID? 

    Translate
    Box Employee
    May 22, 2025 11:46 AM UTC

    Hi Kourtney,

    What exactly is the difference between an app user and a managed user in terms of access?

    The user id belongs to our organization and can be used to login and view files in box. Not sure if this information will help you.

    Translate