You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an issue with requests for which execution takes more time then default expiration time (1 hour). I'm trying to check access token expiration time before sending next request, but it seems that TokenProvider.GetAccessToken() just generates new access token on each execution.
You can get an idea of my logic from the following:
was:
CloudMediaContext _mediaContext = ...
var job = _mediaContext.Jobs.CreateWithSingleTask(...);
await job.SubmitAsync(); // takes more then 1 hour
return _mediaContext.Assets.Where(...).First(); // throws exception due to invalid token
what I'm trying to do:
CloudMediaContext _mediaContext = ...
var job = _mediaContext.Jobs.CreateWithSingleTask(...);
await job.SubmitAsync(); // takes more then 1 hour
DateTimeOffset tokenExpirationDate = _mediaContext.TokenProvider.GetAccessToken().Item2;
if (tokenExpirationDate < DateTimeOffset.UtcNow) // always false since previous line returns new token and expiration time
{
// get new context (generates new token)
_mediaContext = ...
}
return _mediaContext.Assets.Where(...).First(); // fails since token was not re-generated
My solution never refresh the context since if-statement condition is never occurs to be true.
Is there any way to get expiration time of current access token generated by ITokenProvider?
The text was updated successfully, but these errors were encountered:
I have an issue with requests for which execution takes more time then default expiration time (1 hour). I'm trying to check access token expiration time before sending next request, but it seems that
TokenProvider.GetAccessToken()
just generates new access token on each execution.You can get an idea of my logic from the following:
My solution never refresh the context since if-statement condition is never occurs to be true.
Is there any way to get expiration time of current access token generated by
ITokenProvider
?The text was updated successfully, but these errors were encountered: