JWTRefreshTokenBundle icon indicating copy to clipboard operation
JWTRefreshTokenBundle copied to clipboard

Storing a device name with the token

Open tarjei opened this issue 3 years ago • 2 comments

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?

tarjei avatar Oct 14 '21 11:10 tarjei

With 1.1 this isn't all that bad to pull off:

  1. Make sure you've got an entity set up in your app adding the device name field
  2. Replace or decorate the gesdinet.jwtrefreshtoken.refresh_token_generator service in your app with a custom implementation of Gesdinet\JWTRefreshTokenBundle\Generator\RefreshTokenGeneratorInterface which adds the device name to the generated entity class

mbabker avatar Apr 11 '22 14:04 mbabker

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 ?

markitosgv avatar Jan 30 '23 18:01 markitosgv