Handling oauth2 token expiration on CircleCI builds
Hello,
I'm using CircleCI for a job that synchronizes some assets from a Box account into the job storage. Since the amount of files can be quite big, and with several nested directories, we're simplifying this process with rclone (https://rclone.org/). This works well both in CircleCI and in our dev environments. However, we're facing a problem in that on different runs of the Circle job (it runs 4 times a day), the sync fails because the token expires, even though only a few hours have passed between runs. This forces us to have to regenerate the token very frequently
It looks like Box expires tokens automatically if they're used on different machines, and the way Circle jobs are executed on different runs seems to trigger that expiration.
Is there a way to work around that? Is this filtering done by IP?
Thank you!
-
Hi ,
The issue here is most likely due to token expiration. Our access tokens will be valid for 60 minutes, then will need to be refreshed. Given that your runs are several hours apart then the token will expire during that time. Our SDKs provide automatic refresh capabilities but if that's not an option in CircleCI then yes, you'll need to manually refresh those tokens every hour.
- Jon
Please sign in to leave a comment.
Comments
2 comments