A common task when connecting to 3rd-party APIs is having to deal with API tokens. Usually, these tokens are most easily obtained by a single client authentication call to the API. In addition, they have timed lifespans, requiring you to regularly update them. Without any caching, you will most likely end up creating a new token for every call to the service, resulting in many redundant token requests and by extension, waste time on unnecessary API calls.

In this article, I will explain how to setup a robust system that can automatically cache and renew the API token on your…

Mark Ang

Software Engineer and part-time blogger. Django is my bread-and-butter, but I also like trying new technologies. Follow me for Python and Django tech tips!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store