pallets-eco / flask-jwt

JWT (JSON Web Tokens) for Flask applications
MIT License
564 stars 178 forks source link

Malformed header triggers errors rather than exception handling #130

Open cugels opened 5 years ago

cugels commented 5 years ago

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

vimalloc commented 5 years ago

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/