Skip to main content
Question

"All Files" differs from API folder/0

  • May 22, 2025
  • 1 reply
  • 21 views

Forum|alt.badge.img

Hi, 
  I am authenticating using JWTAuth and impersonating the connection but the root folder (from API) only shows 2 items.

  Here is my code:
        auth = JWTAuth.from_settings_file('box_JWT.json')

        client = Client(auth)
        user_to_impersonate = client.user(user_id='18078459761')
        user_client = client.as_user(user_to_impersonate)
        print("user_client_root_folder")
        items = user_client_root_folder.get_items()
        for item in items:
            print('{0} {1} is named "{2}"'.format(item.type.capitalize(), item.id, item.name))
        print("------------------")

   The result is:
user_client_root_folder
Folder 152730599665 is named "My Box Notes"
File 898778670248 is named "Get Started with Box.pdf"
------------------
   
   And my "All Files" is:
BOX1_djQE289PGFzk_exLhQhEag.png

   Best,
      J. Bosco

1 reply

Forum|alt.badge.img

Hi Joao

You cannot access content that has been shared from an external account with the as-user header. You have to create a token for the user and use this for your API calls.

See this post for reference: https://support.box.com/hc/en-us/community/posts/360051181754-Is-it-possible-to-access-a-shared-external-folder-using-JWT-authentication-