Force handling errors globally:
Configured Flask and Flask-RESTful to propagate JWT exceptions correctly by adding the following code to init.py:
app.config['PROPAGATE_EXCEPTIONS'] = True # Propagate exceptions to the client
api.handle_errors = False # Disable Flask-RESTful
This provided the results I was looking for and I successfully tested the JWT lifecycle:
Login: Issued JWT tokens via /api/login.
Valid Token: Accessed protected resource successfully.
Expired Token: Received expected 401 error ("Token has expired").
Token Refresh: Successfully refreshed JWT token via /api/refresh.
New Token: Validated new token with protected endpoint access.