-
-
Notifications
You must be signed in to change notification settings - Fork 247
Closed
Description
I use a custom JSON encoder in Flask to help serialize my models for my REST end-points. currently this encoder is not passed to jwt.encode:
flask_jwt_extended/tokens.py:29
encoded_token = jwt.encode(token_data, secret, algorithm).decode('utf-8')
The jwt.encode method takes an optional json_encoder argument. I contend that we should use this option to pass in the json encoder for the current Flask app.
It looks like the tokens module has been designed to not have any knowlege of the config module, so probably the patch here would be to add a new @property to the config object which returns current_app.json_encoder, and then to add json_encoder as an optional argument to all encoding methods in tokens.py.
Happy to provide a PR for this if we agree it's useful and the approach above is correct.
Metadata
Metadata
Assignees
Labels
No labels