Search code examples
lynclync-2013ucwa

Application expires after 1h even when regularly reporting my activity


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.


Solution

  • 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:

    1. Send Request
    2. Check Response status code
    3. If 401...
      • Check WWW-Authenticate header and re-issue authentication request(s)
      • Store token and proceed back to step #1
    4. Process Response

    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.