0

So I have a JWT token being generated and after 10 minutes it expires. Once it expires, I want to be able to catch this 401 error code. I am using flask_jwt_extended library. This is my code:

@dossier_blueprint.route("/week", methods=["GET"])
@jwt_required
# @app.cache.cached(timeout=800)
def get_dossier_created_this_week():
    return dossier_service.query_aantal_dossiers_deze_week_bvcm_c2c()
Seyfullah
  • 68
  • 7
  • See this for custom error responses, which has 401 as an example on the accepted answer: https://stackoverflow.com/questions/7877230/standard-401-response-when-using-http-auth-in-flask. – Jon Feb 07 '20 at 16:38
  • @jon but flask_jwt_extended gives his own error precedence above my global error exception which you can find in the link you have given. – Seyfullah Feb 10 '20 at 07:31
  • maybe try registering a custom handler and setting app.config['PROPAGATE_EXCEPTIONS'] = True https://stackoverflow.com/questions/33423580/errorhandler-not-firing-when-debug-is-false – Jon Feb 10 '20 at 14:10

0 Answers0