This recipe will show you how to use Redis to store access tokens and also approval information. Unlike the previous recipe, we won't use Redis to store client details because this kind of data must be persistent and Redis uses a memory data structure to store data.
To run this recipe, you need a Redis database (make sure to set up Redis authentication for production environment) along with the other tools, such as your preferred IDE and tools that allow you to interact with the OAuth 2.0 Provider. The source code for this recipe is available on GitHub at https://github.com/PacktPublishing/OAuth-2.0-Cookbook/tree/master/Chapter02/redis-server.
Perform the following steps to set up Redis to store tokens:
- As the Redis database is a prerequisite, you need to download and install Redis on your machine. Download the latest stable version from https://redis.io/download.
- After downloading, go to the
Download
directory and run the following commands...