Previously I had a problem that my UCWA application expired after some time. As a solution to this problem, I have found out that I should make a request every now and then to keep it alive. I decided to set an interval and every 3 minutes request reportMyActivity
resource.
However, no matter what, my application always expires after 1 hour. Is there any solution to this? Alternatively, what is the recommended way of re-creating application without leaving website using sample libraries?
Thanks.
The time at which the token expires is not entirely relevant, what is important is the 401 Unauthorized indicating that the token has expired. In that failed request there should be one (or two) WWW-Authenticate headers which can be used to point at where to get the next token. You may consider altering the logic responsible for sending requests to UCWA to reflect something like the following:
This way the application would not need to keep track of the expiry time of the token and could lazily retrieve a new one once it encounters the 401.