Force.com-Toolkit-for-NET icon indicating copy to clipboard operation
Force.com-Toolkit-for-NET copied to clipboard

Handling refresh tokens

Open naicigam opened this issue 7 years ago • 0 comments

Based on #241, I am doing a wrapper to handle token expirations. For each operation I am doing something like:

try
{
    return await _client.CreateAsync(record.SObjectType, record);
}
catch (ForceException e)
{
    await RefreshTokenOrRethrowException(e);
    return await _client.CreateAsync(record.SObjectType, record);
}

which is pretty verbose.

So my first question is: should we handle token expiration inside the ForceClient? I could work on a PR for this.

My next question is regarding bulk operations: for example RunJobAndPollAsync makes several API calls and each of these should handle a potential token expiration. If we handle them in the ForceClient class, we could do it in the individual functions, like RunJobAsync and PollBatchAsync, but if not, what would be a good strategy to deal with this?

Thanks!

naicigam avatar Oct 25 '18 20:10 naicigam