JWTRefreshTokenBundle
JWTRefreshTokenBundle copied to clipboard
Storing a device name with the token
Hi, is it possible to store a device name with a given token - for example using an extra event listener on token creation that can fetch the device name from the request?
With 1.1 this isn't all that bad to pull off:
- Make sure you've got an entity set up in your app adding the device name field
- Replace or decorate the
gesdinet.jwtrefreshtoken.refresh_token_generator
service in your app with a custom implementation ofGesdinet\JWTRefreshTokenBundle\Generator\RefreshTokenGeneratorInterface
which adds the device name to the generated entity class
It might be a good idea to store some kind of unique hash per device/browser/ip/location to be able to show a list to users of which devices are connected and the last renewal and even to be able to revoke specifically the tokens needed.
How do you see it @mbabker ?