flask-jwt icon indicating copy to clipboard operation
flask-jwt copied to clipboard

Malformed header triggers errors rather than exception handling

Open cugels opened this issue 6 years ago • 1 comments

When sending a POST call to /auth, an errored header with junky fields, triggers a 500 server error. I assume that it should send back a response with the error code or some exception handling message.

To replicate this, type some junk into the key and value, then make a call. If you get the error I’m seeing, on a dev instance, the error handler spits out:

AttributeError: 'NoneType' object has no attribute 'get' Then the callback ends with: There’s a long list of errors, which end with: File "D:_xampp\htdocs_github\spear_api\flask\venv\lib\site-packages\flask_jwt_init_.py", line 115, in _default_auth_request_handler username = data.get(current_app.config.get('JWT_AUTH_USERNAME_KEY'), None)

It looks like this is related to an old issue, so perhaps this has reemerged: https://github.com/mattupstate/flask-jwt/issues/80

cugels avatar Feb 03 '19 05:02 cugels

This project has been abandoned for quiet a while now. Perhaps check out flask-jwt-extended as an alternative. https://flask-jwt-extended.readthedocs.io/en/latest/

vimalloc avatar Feb 03 '19 05:02 vimalloc