Fix math for bearer token refresh time (#1593)
This commit is contained in:
parent
4f7e8c03bf
commit
2f250f3968
@ -2,6 +2,9 @@
|
||||
|
||||
## 1.0.0-beta.6 (Unreleased)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fixed computation of the token expiration time in `BearerTokenAuthenticationPolicy`.
|
||||
|
||||
## 1.0.0-beta.5 (2021-02-02)
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ std::unique_ptr<RawResponse> BearerTokenAuthenticationPolicy::Send(
|
||||
std::lock_guard<std::mutex> lock(m_accessTokenMutex);
|
||||
|
||||
// Refresh the token in 2 or less minutes before the actual expiration.
|
||||
if ((std::chrono::system_clock::now() - std::chrono::minutes(2)) > m_accessToken.ExpiresOn)
|
||||
if (std::chrono::system_clock::now() > (m_accessToken.ExpiresOn - std::chrono::minutes(2)))
|
||||
{
|
||||
m_accessToken = m_credential->GetToken(context, m_tokenRequestOptions);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user