In the previous recipe, we retrieved a token for our client and performed API requests. The downside of this approach is that we have no long-term storage for our token. In an HTTP server, for example, we'd like to have consistent storage of the token between requests.
This recipe will explore modifying the OAuth2 client to store a token between requests and retrieve them at will using a key. For the sake of simplicity, this key will be a file, but it could also be a database, Redis, and so on.