pythonsdkbox-apiboxboxapiv2

write a script to send files to box application by automatic developer token generation


Requirement: I need a script that sends files to box.

So far, i managed to send the files to box by following https://docs.box.com/docs/getting-started-box-integration . I am using box-python-sdk to acheive this, but i have to use this developer token which is active only for 60 min for authenticaton. I have to generate a developer token everyday to run this script.

    oauth = OAuth2(
         client_id=CLIENT_ID,
         client_secret=CLIENT_SECRET,
         access_token=DEVELOPER_TOKEN,
         ) 
client = Client(oauth)

I cannot set the redirect URI as am not running an application on a server, am just running this script using "python box.py ". Is there a way to refresh the developer token in my script?


Solution

  • This can be achieved using JWT authentication, refer https://github.com/box/box-python-sdk.