Skip to main content
Question

How to give access to service account (Python SDK)

  • May 21, 2025
  • 1 reply
  • 31 views

Forum|alt.badge.img

I'm running the code below to try and search through content on my Box instance.  However, when I get the access_token below, it does not have access to any of the content I've uploaded to box.  How can I ensure the content I've uploaded is available to the service account when hitting the search API endpoint?

 

def main():
auth = JWTAuth(
client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
enterprise_id=ENTERPRISE_ID,
jwt_key_id=JWT_KEY_ID,
rsa_private_key_file_sys_path=RSA_PRIVATE_KEY_PATH,
rsa_private_key_passphrase=RSA_PASS,
)
access_token = auth.authenticate_instance()

client = Client(auth)

query = client.search('j', limit=100, offset=0)
print(query)

# run main
if __name__ == "__main__":
#execute main if run as a script
main()

1 reply

Forum|alt.badge.img

Hi,

 

You will need to add your service account as the collaborator of the box content you uploaded. Box logic is sort of like this: In terms of the content access, the service account, app user account, and box account are independent and they all have their own territories. Unless you add one account as the collaborator of another account's content,  each account will not be able to access other acount's content. 

 

Joy