Skip to content

Commit

Permalink
Re-authneticate with server after timeout
Browse files Browse the repository at this point in the history
Possible fix for issue Update Service state machine does not refresh token WildernessLabs#414. Attempts to re-autheticate prior to download if token already expired.
  • Loading branch information
doingnz committed Dec 30, 2023
1 parent a37dbcf commit 56c8f15
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/Meadow.Core/Update/UpdateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@ public void RetrieveUpdate(UpdateInfo updateInfo)
throw new ArgumentException($"Cannot find update with ID {updateInfo.ID}");
}

// check if we need to re-authenticate with the server before starting download.
if (ShouldAuthenticate())
{
AuthenticateWithServer().Wait();
}

if (message != null)
{
Task.Run(() => DownloadProc(message));
Expand Down

0 comments on commit 56c8f15

Please sign in to comment.