Usage of refreshToken

I’m working on integrating vue storefront with Tryton. For the user module, I do not know what is the purpose of the refreshToken and when is the /api/user/refresh used. I guess that it will be used when the token expires but how do we tell Vue Storefront that the token has expired? Is there a specific code to return on any request?
Is it mandatory to implement a refreshToken?

Thanks.