Issues with access folders/files after successful login with client = Client(auth)
AnsweredGood 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
-
Official comment
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
Comment actions -
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
Please sign in to leave a comment.
Comments
3 comments