0

Is there a way to force expire jwt token (not refresh token) in adonis-js. I am creating a token on login and setting its time to expire for 10 mins. When I log out I want to force expire that token before 10 mins.

Abdul
  • 1,416
  • 9
  • 26
  • 57
  • Does this answer your question? [Invalidating JSON Web Tokens](https://stackoverflow.com/questions/21978658/invalidating-json-web-tokens) – Laxmikant Dange Dec 25 '19 at 07:54

1 Answers1

1

I did it this way:

async login({ request, auth }) {
  const { email, password } = request.all();
  const user = await auth.validate(email, password, true);
  const { name, admin, confirmed } = user;
  const token = await auth.generate(user, false, { expiresIn: '10m' })
  return { token, user }
}
Sandro
  • 63
  • 5