Joel
Joel

Reputation: 2688

Maintaining Box refresh / access tokens in a disrtibuted system

We have multiple servers that access Box, so we turn off auto-refresh.

connect.setMaxRequestAttempts(1);
connect.setAutoRefresh(false);

Assumptions gathered from unit tests:

Given that, it appears you can have multiple readers with one writer updating the token pair, even if a reader gets the previous token pair, it should be fine (for access).

We ensure that only one thread in the system updates the tokens, but yet are having issues with 401 errors in spite of locking down the token updates. It seems there something wrong with the assumptions above.

Upvotes: 1

Views: 151

Answers (1)

Murtza Manzur
Murtza Manzur

Reputation: 1214

Your assumptions are close. Here is the expected behavior:

  • A token is valid for one hour, unless a new token is requested and used.
  • If a new token is requested but not used, the old token is still valid (assuming it less than one hour old).
  • If a new token is requested and used, the old token is invalidated.

Upvotes: 1

Related Questions