From ef8445631147f13244bce633cca536bcd3a6ea1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20B=C3=BCchel?= Date: Fri, 25 Nov 2022 14:32:58 +0100 Subject: [PATCH] SEBWIN-621: Fixed race condition happening with OAuth2 token renewal. --- SafeExamBrowser.Server/ServerProxy.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SafeExamBrowser.Server/ServerProxy.cs b/SafeExamBrowser.Server/ServerProxy.cs index f4f3ceb1..abf49e3c 100644 --- a/SafeExamBrowser.Server/ServerProxy.cs +++ b/SafeExamBrowser.Server/ServerProxy.cs @@ -421,7 +421,6 @@ namespace SafeExamBrowser.Server { try { - var authorization = ("Authorization", $"Bearer {oauth2Token}"); var contentType = "application/json;charset=UTF-8"; var token = ("SEBConnectionToken", connectionToken); @@ -429,6 +428,8 @@ namespace SafeExamBrowser.Server { if (logContent.TryDequeue(out var c) && c is ILogMessage message) { + // IMPORTANT: The token needs to be read for every request, as it may get updated by another thread! + var authorization = ("Authorization", $"Bearer {oauth2Token}"); var json = new JObject { ["type"] = message.Severity.ToLogType(),