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

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

Open skirdey opened this issue 9 years ago • 4 comments

  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'

skirdey avatar Sep 17 '16 18:09 skirdey

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 :)

vimalloc avatar Sep 21 '16 15:09 vimalloc

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!

skirdey avatar Sep 21 '16 16:09 skirdey

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

vimalloc avatar Sep 21 '16 16:09 vimalloc

did anyone solve this error?

prameshbajra avatar Feb 21 '19 09:02 prameshbajra