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.
@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.
At the start of the application a
ShareFileClient
is initialized (OAuthToken
is obtained using password authentication). TheShareFileClient
is cached and will be used for all interactions with the ShareFile API. At each request, theShareFileClient
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.