In my application, I return an access token and a refresh token when a user logs in successfully. The expiration times for access and refresh token have been set to 10 and 40 minutes respectively. (I should do some more research on those values. This is just for testing)
I used the implementation described in following article
http://www.svlada.com/jwt-token-authentication-with-spring-boot/
Let's say I invoke a request to the server after 10 minutes of the login in. Since the access token is expired, I am getting 401 error response.
However, as a beginner, I find it difficult to understand whether I need to send the refresh token explicitly in order to obtain a new access token. If I should do so, how to do that? I should send the refresh token as what? a header?
Or else, when my request is rejected by the server since the access token is expired, should the refresh token itself send a request automatically to the server in order to obtain a new access token?
I found it hard to understand the nature of the behavior of refresh token from the resources I found on the net. Kindly clarify me on these questions.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…