public class TokenRefreshOptions extends Object
| Constructor and Description |
|---|
TokenRefreshOptions() |
| Modifier and Type | Method and Description |
|---|---|
Duration |
getOffset()
Returns a Duration value representing the amount of time to subtract from the token expiry time, whereupon
attempts will be made to refresh the token.
|
public Duration getOffset()
SimpleTokenCache and BearerTokenAuthenticationPolicy
to proactively retrieve a more up-to-date token before the cached token gets too close to its expiry. You can
configure this from the .tokenRefreshOffset(Duration) method from any credential builder in the
azure-identity library.
Extending this offset is recommended if it takes > 2 minutes to reach the service (application is running on
high load), or you would like to simply keep a more up-to-date token in the cache (more robust against token
refresh API down times). The user is responsible for specifying a valid offset.
When a proactive token refresh fails but the previously cached token is still valid,
BearerTokenAuthenticationPolicy will NOT fail but return the previous valid
token. Another proactive refresh will be attempted in 30 seconds.Copyright © 2020 Microsoft Corporation. All rights reserved.