citrix / ShareFile-NET

C# library for accessing ShareFile V3 API
MIT License
36 stars 26 forks source link

Cache ShareFileClient #14

Closed alexandrugheorghiu closed 9 years ago

alexandrugheorghiu commented 9 years ago

At the start of the application a ShareFileClient is initialized (OAuthToken is obtained using password authentication). The ShareFileClient is cached and will be used for all interactions with the ShareFile API. At each request, the ShareFileClient is verified to be valid (?) -- if it isn't, it automatically re-authenticates. The goal here is to authenticate only when needed and to reuse the authentication as much as possible.

How would one go about caching the ShareFileClient in this context? Or is it a better way of achieving this functionality?

I've read the Refreshing an OAuthToken from the Authentication section of the documentation, but I don't think it really applies here.

rgmills commented 9 years ago

@alexandrugheorghiu You'd achieve this by caching the OAuthToken then next time the process runs you can choose to always refresh it or wait for a call to fail then handle the refresh.