Skip to main content
Question

Automate token generation

  • May 21, 2025
  • 6 replies
  • 60 views

Forum|alt.badge.img

Hello,

 

I created a cURL script to update a file info which needs a token. Currently, I am not using OAUTH neither JWT for the authentication process in real time (which could be complex to implement).

 

I am using the 'Box Token Generator' to manually generate the token which is valid for only 60 minutes. Hence every hour I have to refresh it and get a new one.

 

When I have the new token I need to update my cURL script.

 

I would like to use the same logic, automate the process and avoid the manual steps (manual re-generation of the token).

 

Can you please suggest the best approach.

 

Thanks, ZZ

6 replies

Forum|alt.badge.img

Any suggestion/recommendation ?


Forum|alt.badge.img

 You can use a Service Account to update a file's info. With a Service Account, you would use our JWT authentication model.


Forum|alt.badge.img

Does it mean with a Service Account and the JWT authentication model, there is no need to refresh the token within a cURL script ?

 

Thanks.


Forum|alt.badge.img

 With JWT you still would have to refresh the token after 60 minutes, but you can do it programatically. 


Forum|alt.badge.img

Thanks @Murtza. What would be the easier way to implement JWT ? 


Forum|alt.badge.img

 As a next step, I would suggest reading through the guides below and then explore building with one of our SDKs. We support JWT authentication through most of our SDKs.

 

Guides

Getting Started with Box Platform

Configuring Your Application

Authentication with JWT