feat(authenticate-service): add filter to modify payload #48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Link
#47
Types of changes
Description
I needed to extend the returned payload from the plugin. The plugin only allows you to choose from a fixed number of payload options. By adding in a filter called
simple_jwt_login_generate_payload
, we can add new payload values to the generated JSON Web Token. I needed this to add a user avatar to the payload.How has this been tested?
This is a minor addition and has been tested in a real-world application. An example of this filter being used can be found in this open source application here.
As the
apply_filters
API is being used to pass in the$payload
variable and then return it, nothing happens by default unless the user implements their own filter hook.Please note that I did not write any test cases for this, as the behaviour introduced into this change is related to a WordPress API function.
Checklist: