JWTRefreshTokenBundle icon indicating copy to clipboard operation
JWTRefreshTokenBundle copied to clipboard

Event before RefreshToken is persisted

Open SebastienTouze opened this issue 6 years ago • 2 comments

Hi all,

I think it can be usefull to have an Event dispatched before the RefreshToke is persisted to add some data inthe Entity. My current usecase is that I want to store the userAgent of the user's device when s/he connnect for the first time. Currently I do that listening to lexik_jwt_authentication.on_authentication_success adding my data and persisting again the RefreshToken. But that makes 2 DB operations where only one is necessary.

Having an event in the Gesdinet\JWTRefreshTokenBundle\Doctrine\RefreshTokenManager::save or AttachRefreshTokenOnSuccessListener::attachRefreshToken should allow to add some data to the Entity before persist.

Regards

SebastienTouze avatar Sep 04 '18 09:09 SebastienTouze

I will create a pull request for this. I've implemented this.

Use case: When you have a multiple authenticators (like one for your web-app and one for your mobile-app) and you want to store the type.

SherinBloemendaal avatar Aug 06 '20 09:08 SherinBloemendaal

why is the pull request closed

luffy1727 avatar Jan 18 '21 05:01 luffy1727