ConfidentialClientApplicationBuilderExtensions.OnBackgroundTokenRefreshCompleted Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Configures an async callback invoked when a fire-and-forget background (proactive) token refresh completes. Proactive refresh runs on a background thread after the caller has already received a valid cached token, so its outcome (latency, failures) is otherwise unobservable. This callback surfaces it, e.g. for telemetry.
public static Microsoft.Identity.Client.ConfidentialClientApplicationBuilder OnBackgroundTokenRefreshCompleted(this Microsoft.Identity.Client.ConfidentialClientApplicationBuilder builder, Func<Microsoft.Identity.Client.Extensibility.ExecutionResult,System.Threading.Tasks.Task> onBackgroundTokenRefreshCompleted);
static member OnBackgroundTokenRefreshCompleted : Microsoft.Identity.Client.ConfidentialClientApplicationBuilder * Func<Microsoft.Identity.Client.Extensibility.ExecutionResult, System.Threading.Tasks.Task> -> Microsoft.Identity.Client.ConfidentialClientApplicationBuilder
<Extension()>
Public Function OnBackgroundTokenRefreshCompleted (builder As ConfidentialClientApplicationBuilder, onBackgroundTokenRefreshCompleted As Func(Of ExecutionResult, Task)) As ConfidentialClientApplicationBuilder
Parameters
The confidential client application builder.
- onBackgroundTokenRefreshCompleted
- Func<ExecutionResult,Task>
An async callback that receives the ExecutionResult of the background refresh. On success, Result holds the refreshed token; on failure, Exception holds the exception, whose AuthenticationResultMetadata carries the failed attempt's HTTP duration.
Returns
The builder to chain additional configuration calls.
Exceptions
Thrown when onBackgroundTokenRefreshCompleted is null.
Remarks
Invoked on a background thread. Check Successful to determine the outcome.
Exceptions thrown by this callback are caught and logged internally so they cannot disrupt the refresh.