How to increase or Set expiry time of jwt authentication dynamically

Hey,
Here I am using JWT authentication with using this code.

await auth.attempt(email, password))
let token = await auth.generate(user)

All things working fine.

But here i have an issue that is, if system is ideal for few minutes or hours. No action performed by user then suddenly user start to perform action before expire jwt token then that case I am unable to increase or reset expiry time of jwt in auth.js file.

Can you please help or guide what i am going wrong…?

Hi :wave:,

To extend the duration you can refresh the token:
https://adonisjs.com/docs/4.1/authentication#_generateuser_jwtpayload_jwtoptions

Revoke the token:
https://adonisjs.com/docs/4.1/authentication#_revoking_tokens

Have a nice day

2 Likes