Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,16 @@ private OAuthException(SerializationInfo info, StreamingContext context)
/// <returns></returns>
private async Task<OAuthResponse> RefreshTokenAsync()
{
var content = new FormUrlEncodedContent(new Dictionary<string, string>()
while (true)
{
var content = new FormUrlEncodedContent(new Dictionary<string, string>()
{
{ "grant_type", "client_credentials" },
{ "client_id", MicrosoftAppId },
{ "client_secret", MicrosoftAppPassword },
{ "scope", OAuthScope }
});

while (true)
{
using (var response = await g_httpClient.PostAsync(OAuthEndpoint, content).ConfigureAwait(false))
{
string body = null;
Expand All @@ -336,13 +336,13 @@ private async Task<OAuthResponse> RefreshTokenAsync()
#if NET45
System.Diagnostics.Trace.TraceError(body ?? response.ReasonPhrase);
#else
logger?.LogWarning($"RefreshTokenAsync() Exception) {body ?? response.ReasonPhrase}");
logger?.LogWarning($"RefreshTokenAsync() Exception {body ?? response.ReasonPhrase}");
#endif

}

// try again in a bit to prevent hammering a service if it's not working
await Task.Delay((int)TimeSpan.FromSeconds(1).TotalMilliseconds);
await Task.Delay(TimeSpan.FromSeconds(30));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

30 seconds? Is this change intentional? (that's a long time)

}
}
}
Expand Down