I have started using spring session in my jersey rest api, is there a way we can renew the expired session token . I know that we are deleting the token as soon as it ttl is over but is there any way I can achieve this. Any help is highly appreciated . Thank you so much
0
votes
1 Answers
0
votes
This is how we solved this problem:
- Based on username & password we are getting access token+refresh token. Mention grant type is password in this case.
- We are saving token in session.
- [access token] as key and [accesstoken, UserDetails, RefreshToken and expiryTime] as value.
- Each time a reuest is coming to the server, we are checking the expiry time in the session with the current system time.
- Once a token is expired. InvalidTokenException is thrown.
- Catch the exception in the front end and send another request with acesstoken + refresh token + grantType="refresh_token".
- Then we are checking if refresh is there in the session or not. If yes, we issue a new token and update expiry time.
Please refer this image.
