JWT token, where is it stored


Hi guys,

I’m trying to setup a JWT based auth.
auth.attempt(email, password) is working great.
I have a token generated and no error.

But I was wondering where is stored the token on the server side?
I would like to use Lucid serializer, but I’ve got nothing on any of my models. Do I need to do something else manually?

Beside, I see no way to indicate the field used to store the token.

Thank you a lot for your attention. Adonis is great to use!


JWT tokens aren’t stored in database. Usually, you send for user a JWT token and a refresh token. JWT tokens are short lived, arround 15 ~ 60 minutes. When JWT expire you use a refresh token to get a new JWT. Refresh tokens are stored in database. In attempt, you can use:

auth.withRefreshToken().attempt(email, password)

and refresh tokens are automatically stored.


How does adonisjs then keep track of the number of active jwt tokens especially in a multiple people accessing the site at the same time and using different jwt tokens