Access token not expiring when new token is generated

Hi Team,

When I generate 2 access token using some credentials

and try to use the 1st token then it is valid and it gives me a response.

I want my old token to be expired when a new token is generated.

how can I do that?

Hi Prajwal,

What version of Jmix are you using?

To revoke the old token, you need to do the following steps:

  1. Create an oauth/revoke endpoint.
  2. Save the token each time it is generated
  3. If you have an old token (generated earlier), send a request to the /oauth/revoke endpoint to revoke the old access token.

Ilya

Hi Ilia,

I am using JMIX 1.5.5
Can you share any examples of what you have suggested?
a jmix documentation will also work,

The good starting point is Jmix docs.

Also I prepared example project with simple generate/revoke token logic.
TokenRevokeExample.zip (162.9 KB)

The “Revoke token example” screen contains three buttons:

  1. Shows all current tokens.
  2. Generate a new token.
  3. Generate a new token and revokes all previous tokens.

Ilya