Hello! Following the advice from this thread that I asked a few weeks ago, I was able to get my app approved for the Box environment; however, we are now undergoing the process for adding the service account as a collaborator to the folders that the JWT service account will need access too.
I feel as if I'm missing some information, since I'm not too aware of how to physically add the "service" account once it was authorized. In fact, I'm not really understanding how to find the service account at all. Using the JWT auth, I am doing this:
from boxsdk import JWTAuth from boxsdk import Client import config auth = JWTAuth( client_id=config.client_id, client_secret=config.client_secret, enterprise_id=config.enterprise_id, jwt_key_id=config.public_key_id, rsa_private_key_data=config.private_key, rsa_private_key_passphrase=config.passphrase ) access_token = auth.authenticate_instance() client = Client(auth) # print(client.file(file_id='***number removed for privacy***9').get()['name'])
This code will run successfully; however, if you uncomment out the print() statement (and place the correct file_id) it fails immediately from a 404 error. My guess is that it cannot open the already-created files since it was not added as collaborator, so it cannot see them. Do I need to create a new user with the JWT app, then add that new user as a collaborator? Then enforce the JWT app to use that newly created user as it's main connection into Box?
Or, is there a simpler method? I currently have the "Application" scope selected with only Read/Write on all files & folders. I would have to additionally add "Manage Users" if I wanted to go the route of having to create a new user.
End Goal: Have the service account programmatically create sub-folders (in specific primary folders we give it access to) and upload word documents.
Please sign in to leave a comment.