Skip to main content
Question

Issues with access folders/files after successful login with client = Client(auth)

  • May 22, 2025
  • 3 replies
  • 26 views

Forum|alt.badge.img

Good day,

 

my login is successful and I get successfully printed my Box UserID.

However, getting folders or files details. Any advice on how to troubleshoot the code further, please?

 ============== Code

from boxsdk import JWTAuth, Client

auth = JWTAuth.from_settings_file('C:/Users/User_1/XXXXXXX_YYYYYYY_config.json')
client = Client(auth)
print(client)

#working
service_account = client.user().get()
print('Service Account user ID is {0}'.format(service_account.id))

#not working
folder_id='0'
items = client.folder(folder_id).get_items()
print("Items", items)

=====================

I hope someone can advise.

Thank you.

Kind regards,

Marin

3 replies

Forum|alt.badge.img

Response:

 

Exception reporting mode: Verbose
<boxsdk.client.client.Client object at 0x000001FA17F1B4C0>
Service Account user ID is XXXXXXXXXXX
Items <boxsdk.pagination.limit_offset_based_object_collection.LimitOffsetBasedObjectCollection object at 0x000001FA185D47C0>

Forum|alt.badge.img

Hey Marin, 

 

By default, the service account user isn't going to have any content shared with it. Have you added this user as a collaborator on the content you'd like it to return?

 

Best, 

Kourtney 


Forum|alt.badge.img

Hi Kourtney,

thank you for your prompt reply, your suggestion is spot on!

The "Box Application User" has a different Collaborator Email generated automatically by Box and completely separated Box "Container".

What confused me is that  I'm actually the Developer and I did select "Enterprise" application access. 

After your comment, using the "Box Admin Console" I found the Application User content space using the "Content Manager". I was happy to find my "lost" Box Folders I created using the Box REST API.

By chance, I did right-click on the user in the "Content Manager" and manage to login into his Box account.
That way I found the Email address for that "Box Application User" AutomationUser_XXXXXXX_asdfghjkl@boxdevedition.com and use that Email address to add as a Collaborator and all in order now.

For some reason, I missed instructions for the steps above when creating my Box Application.

Thank you again!

Kind regards,

Marin