vaadin-connect icon indicating copy to clipboard operation
vaadin-connect copied to clipboard

Vaadin Client should proactively refresh the expiring access token

Open vlukashov opened this issue 6 years ago • 0 comments

When using the Vaadin Services JS client, I want it to proactively refresh the access token when it is about to expire, so that there is no additional network round trip when calling a Vaadin Service backend method with an access token that is known to be expired.

DoD:

  • when Vaadin Client has both accessToken and refreshToken, and the access token is about to expire (the exact time should be configurable), it sends a request to the backend to refresh the access token
  • a new auth.access-token-proactive-refresh-time property is documented as one of supported vaadin.properties (the value is time in seconds, default is 30 seconds)
  • to avoid draining the battery of a user device, proactive token refreshing happens only when the browser tab is active
  • proactive token refresh can be disabled by setting the auth.access-token-proactive-refresh-time property to -1 (should be documented)
  • if a proactive refresh request is intertwined with an active service method call, then
    • the active call uses the access token available at the time of the call
    • if the active call fails due to access token expiration, and the proactive refresh is completed between the active call request was sent with the expired access token and the active call failure response was received, the active call is retried with the new access token without using the refresh logic outlined in #12

The common DoD applies.

vlukashov avatar Oct 31 '18 14:10 vlukashov