Re-using UCWA app after page reload

200 views Asked by At

Is it possible to re-use UCWA app/token when navigating on a website instead of authenticating and creating new application after navigating to another page (aka clicking on a links in a menu - not leaving the actual website)?

At the moment I have to re-authenticate each time I reload page which is not acceptable. Using a single-page application like in the examples is not possible in my case either.

Any suggestion is welcomed.

1

There are 1 answers

3
ShelbyZ On BEST ANSWER

Yes it is possible and you will need to keep track of a few key pieces of data to make the transition easier:

  • The current OAuth token used in the Authorization header - Authorization: Bearer cwt=$unique_id

Choose 1

  1. The root application Href - /ucwa/oauth/v1/applications/$id
  2. The application Href used to create an application and the body content used to create the original application - https://lync.domain.com/ucwa/oauth/v1/applications + {'userAgent':'UCWA Samples','endpointId':'1234','culture-en-US'}

For the first case the idea is to issue a GET request on that Url and get access to the application resources. For the second case the idea is to issue a POST request to the application Href using the original body data which should result in a 200 (OK) as opposed to 201 (Created) because it already exists.

This answer assumes that the OAuth token is still valid.

One thing to also consider is whether or not the application was issuing a P-GET (pending GET) on the events resource. If it was, some form of logic should be put in place to cancel/suspend requests until the new logic is loaded to handle process events.

The interesting part is that it is not required to track what event ack the application was on because either the response from the applications request will provide the correct ack (/ucwa/oauth/v1/applications/$id/events?ack=x) or a request to the events resource will provide a resync href pointing to the correct ack.