token_required decorator in api/decorators/token_required.py that validates the Authorization: Bearer <token> header on incoming requests.
The token_required decorator
Protecting a route
Apply@token_required as a decorator on the route function:
Authorization header return:
JWT validation
The default decorator has a placeholder for token validation. To validate JWTs, add your decoding logic in thetry block:
AWS Cognito authentication
TheEnvironment class includes all necessary Cognito variables for validating Cognito JWTs:
flask-Cognito package (included in requirements.txt) to validate Cognito tokens inside token_required.