LexikJWTAuthenticationBundle icon indicating copy to clipboard operation
LexikJWTAuthenticationBundle copied to clipboard

Questions about TTL

Open siwica opened this issue 5 years ago • 2 comments

For some applications talking to my API I need to create JWTs with TTLs different from my default one of 3600. How do I do that given that lexik:jwt:generate-token doesn't have a ttl parameter?

Also, how is it possible to write some logic to set the TTL on a per user basis?

siwica avatar Sep 09 '19 07:09 siwica

I think you can use Custom User Checker for this.

TTL per user basis indicates that it is a User's property. In this case it can be where user is, e.g. in database. You can also have it as per Role basis. You can use this property in Custom User Checker to decide whether to allow authentication or not.

EresDev avatar Sep 09 '19 22:09 EresDev

I think you can use Custom User Checker for this.

TTL per user basis indicates that it is a User's property. In this case it can be where user is, e.g. in database. You can also have it as per Role basis. You can use this property in Custom User Checker to decide whether to allow authentication or not.

+1 I think this is the solution for this case.

fd6130 avatar Sep 16 '21 14:09 fd6130