Skip to content

Commit

Permalink
fixL force to re-login if the identity will expire in 24hs or less (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lorux0 authored Aug 6, 2024
1 parent c2f4cb3 commit 067cdaa
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 067cdaa

Please sign in to comment.