pallets-eco / flask-jwt

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

_default_auth_request_handler() Doesn't check for NoneType request.get_json() #99

Open skirdey opened 8 years ago

skirdey commented 8 years ago
  1. Send POST request with no payload to /auth
  2. Flask will return 500 Internal server error, in the debug mode it shows AttributeError: 'NoneType' object has no attribute 'get'
vimalloc commented 8 years ago

Perhaps check out https://github.com/vimalloc/flask-jwt-extended. It provides more leeway in this regard, as you define your own endpoint for authing, and once your code has run, you can use functions like 'create_access_token' or 'create_refresh_token' to generate the JWTs, and return them in whatever way works for you. It also supports refresh tokens, revoking tokens, and fresh/unfresh tokens out of the box. (This is totally a shameless pug, as I'm the author of that extension).

It's still under development, but the code should be basically finalized today, and proper readthedocs should be here by the end of the week :)

skirdey commented 8 years ago

Hey @vimalloc, I think I got a little lost in the forks of the current project. It seems like there are a lot of outstanding PRs. Thanks for mentioning flask-jwt-extended, seems interesting and I will give it a shot!

vimalloc commented 8 years ago

Glad to hear it! :) If you can think of any ways to improve upon it, I would love to hear them. Cheers.

prameshbajra commented 5 years ago

did anyone solve this error?