camunda-community-hub / zeebe-client-node-js

Node.js client library for Zeebe Microservices Orchestration Engine
https://camunda-community-hub.github.io/zeebe-client-node-js/
Apache License 2.0
152 stars 38 forks source link

In-memory cache eviction doesn't honor expires_in #307

Closed Walliee closed 1 year ago

Walliee commented 1 year ago

OAuthProvider has an in-memory cache that is populated when a token response is received from server or parsed from file cache. The intention of the startExpiryTimer function in OAuthProvider is to expire/delete the cached in-memory token by taking into account the value of expires_in from in the response back from oauth server.

Expected Behavior

Token is evicted from in-memory cache once it expires.

Current Behavior

Token is evicted from in-memory cache on the next tick (after receiving response from server) as expiry is not computed and populated on the token, which results in validityPeriod to be NaN and causes the setTimeout to execute immediately.