Skip to main content
Box Employee
May 22, 2025 9:13 AM UTC
Question

Limit app to one folder on Box

Hi,

 

I am trying to setup an application, where I use box dev app for oauth authentication. My question is, that rather then grant access to all the folders in an account, can I just grant access to one particular folder. Also is there a way to set it up, so that only few users (ones who have access to that particular folder) can authenticate, rather then everyone.

 

Thanks.

 

Ravi

    2 replies

    Box Employee
    May 22, 2025 9:14 AM UTC

    You can use JWT authentication over standard oauth, that would allow to create an application account in box to which only application user would have access initially. Application user name would start as "AutomationUser_..." which can be found out after authenticating the application and using GetCurrentUser API.

    Post this you can create a root folder in this users account and add the desired users into this user account.

     

    You can find more details about JWT in the below mentioned articles -

    https://developer.box.com/guides/authentication/jwt/

    https://developer.box.com/guides/authentication/user-types/app-users/

    Translate
    Box Employee
    May 22, 2025 9:14 AM UTC

    Hi Ravi,

    In addition to what @ruchikosh mentioned, I'd recommend taking a look at our token downscoping capabilities to limit access to only 1 file or folder. Just to give an example of this, here's the downscoping call looks like in Node:

    client.exchangeToken('item_preview', 'https://api.box.com/2.0/files/123456789')
      .then(tokenInfo => {
        // tokenInfo.accessToken contains the new downscoped access token
    });

    The first parameter to exchangeToken, item_preview, allows you to specify what you can do with the resource (in this case preview only), then the second param is the resource identifier to restrict the downscoped token to (in this case a file with ID 123456789).

    That should provide the capabilities to restrict tokens to specific resources.

    - Jon

    Translate