private async Task EnsureAccessToken() { if (DateTimeOffset.Now > _tokenWrapper.Expiry.GetValueOrDefault()) { await _accessTokenSemaphore.WaitAsync(); try { if (DateTimeOffset.Now > _tokenWrapper.Expiry.GetValueOrDefault()) { _tokenWrapper = await _authProvider.GetAccessTokenAsync(GraphLiteConfiguration.AzureADGraphApiRoot); } } finally { _accessTokenSemaphore.Release(); } } }