Use refresh token with desktop Python script?Answered
I am using a Python script run from my desktop to update metadata on about 180,000 documents in our Box implementation. I can only let the script run for an hour at a time before my developer key expires. I've been trying to come up with a way to incorporate a refresh token into my script to allow the script to continue running indefinitely. However, all the documentation I've found assumes that the calls to Box are coming from a web application. Does anyone have sample code that will show me how to refresh a developer token using Python on the desktop? Is it even possible?
Developer tokens can never be refreshed. They are meant for development/debugging only, and not for production use.
If you wish to refresh, you must go through our auth process. This means doing either 3-leg OAuth2 (if you want real users to be able to use this program), or doing JWT auth with a service account (for a server-side automation) or an app user.
See https://docs.box.com/docs/authentication for a description of these.
Our official Python SDK http://pypi.python.org/pypi/boxsdk supports all of these types of authentication.
When doing 3-leg OAuth2, you must always make use of a web browser to do the initial authentication, even if the application is not a web application.
Please sign in to leave a comment.