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

feat(authenticate-service): add filter to modify payload #48

Merged
merged 1 commit into from
Oct 6, 2022
Merged

feat(authenticate-service): add filter to modify payload #48

merged 1 commit into from
Oct 6, 2022

Conversation

Vheissu
Copy link
Contributor

@Vheissu Vheissu commented Aug 15, 2022

Issue Link

#47

Types of changes

  • New feature

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:

  • My code is tested.
  • My code follows Simple-JWT-login code style

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 in new payload values which get added to the generated JSON Web Token. I needed this to add a user avatar to the payload.
@nicumicle nicumicle merged commit ffd8036 into nicumicle:master Oct 6, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants