I have a Flask app running in AWS using Flask-JWT-Extended. It is serving REST API calls to a web app.
As I understand from the documentation, the tokens are generated and stored in memory. I am considering storing them external to the Flask app in either a database or Redis. The reason for this is to support load balancing:
- I presume that sticky-sessions would be required to make sure that the client's token can be properly decoded and analyzed for validity
- I am considering putting the app in AWS Lambda, which would probably wipe out the JWT list once the request was served.
My questions are:
- Is there any reason this scheme would not generally work?
- If the tokens are stored outside the Flask app, it is not clear how to override the local token storage and access an external storage medium. Can this be done?