I'm currently writing a webpage (front-end and back-end) which exposes a OAuth2 enabled API.
I'm already able to generate the tokens, and once I have a token I can get to the "protected" resources (given that I have valid scopes ofc.)
However, the problem comes when I access my page in the browser (which is to be the main client for consuming the OAuth2 API).
For testing purposes I've made the token short-lived (2 minutes), and the problem is that once those two minutes are up, the client is kicked out of the system, and cannot access his private resources anymore.
Now, if there were a 2 minutes delay without any requests using the token, this would be ok, however, since the client has been activily using the service since the token was issued, he should not be booted out.
Just imagine if you went to facebook (or any other page you log into), and after half an hour you were logged out regardles of what you had been doing up till then. If you had done nothing, you might have understood it,
but if you were in the middle of answering some comment to a post you just posted, then it would feel rather strange.
So what I need is a way to renew the token, or a way to make the expiration roling, and I have no idea how to do either. Also, there might be better ideas on how to solve this problem that I have not thought about at all, so if you have any other ways of solving this, please do tell.