From 067cdaa10ea13d72191a0d371b91ab20fdf27fbd Mon Sep 17 00:00:00 2001 From: Nicolas Lorusso <56365551+lorux0@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:38:06 -0300 Subject: [PATCH] fixL force to re-login if the identity will expire in 24hs or less (#1667) --- .../AuthenticationScreenController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs index 639c2989fc..fbe63e92ba 100644 --- a/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs @@ -2,7 +2,6 @@ using Cysharp.Threading.Tasks; using DCL.Audio; using DCL.Browser; -using DCL.Character.CharacterMotion.Components; using DCL.CharacterPreview; using DCL.Diagnostics; using DCL.FeatureFlags; @@ -152,7 +151,10 @@ private async UniTaskVoid CheckValidIdentityAndStartInitialFlowAsync() { IWeb3Identity? storedIdentity = storedIdentityProvider.Identity; - if (storedIdentity is { IsExpired: false }) + if (storedIdentity is { IsExpired: false } + // Force to re-login if the identity will expire in 24hs or less, so we mitigate the chances on + // getting the identity expired while in-world, provoking signed-fetch requests to fail + && storedIdentity.Expiration - DateTime.UtcNow > TimeSpan.FromDays(1)) { CancelLoginProcess(); loginCancellationToken = new CancellationTokenSource();