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.
Yes it is possible and you will need to keep track of a few key pieces of data to make the transition easier:
Choose 1
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.