Skip to main content

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.

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 🥑


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.




Is this option related to requesting Access_Token for User ID?


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


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


Hello,





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



Thanks.


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


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


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


Reply