Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flask 2.2.0 json_encoder and json_decoder are deprecated #492

Closed
Sir-MaNiAl opened this issue Aug 4, 2022 · 4 comments
Closed

Flask 2.2.0 json_encoder and json_decoder are deprecated #492

Sir-MaNiAl opened this issue Aug 4, 2022 · 4 comments

Comments

@Sir-MaNiAl
Copy link

Since Flask 2.2.0 json_encoder and json_decoder properties on app are deprecated and was set to None by default (Flask changelog)
JWTManager._encode_jwt_from_config method relies on it. It now raises errors on datetime, UUID, etc. values serialisation.

@vimalloc
Copy link
Owner

vimalloc commented Aug 4, 2022

Thank you for the heads up, looks like there are a few things I need to update for this newest flask release. I will try to get everything updated in the next day or two here!

@jrast
Copy link
Contributor

jrast commented Aug 7, 2022

Looking into this and it seems not as easy to switch to the new concept used by flask regarding json:

  • with app.json_provider_class flask allows now to switch out the complete stdlib json module for another implementation
  • PyJWT does use the stdlib json module and only allows a change of the JSON Encoder

PS: It seems like the case @Sir-MaNiAl mentions where encoding fails is not covered by any tests.

@jrast
Copy link
Contributor

jrast commented Aug 7, 2022

In a first step (Commig 4f18aca) I just reused to old Flask JSONEncoder class and use this as default. However, this will break of someone uses a custom JSON Encoder.

@vimalloc
Copy link
Owner

Fix released in version 4.4.4. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants