oauth2-bundle
oauth2-bundle copied to clipboard
Is there an easy way to add custom data to the JWT payloads?
As far as I can see there's no easy way to modify the payloads for AuthCode and AccessToken/RefreshToken.
It'd be nice if there would be an event about the user being used in the request along with the entities free to modify, the custom data could just be stored as json in the entity itself.
As of now I'm simply creating an additonal entity, linking it to the AccessToken entity (or AuthCode entity), and making my own AccessTokenRepository or AuthCodeRepository where I modify some functions. (btw shame those classes are final)
Hey, I've looked for a way to implement that with an event since my current PR is about that.
Unfortunately, when adding custom value those didn't appear in the JWT payload.
By doing further investigation I find out that it was not supported in thephpleague/oauth2-server and apparently they didn't want to support it, to avoid having heavy payload and other ...
I just did a quick search over it, maybe they now allow it, in that case tell me and i'll try to add to my PR or in a future one ;-)