From e929f5314e302b5bd6685159f311bbef4bff3c36 Mon Sep 17 00:00:00 2001 From: YermekG Date: Thu, 8 Feb 2024 16:35:54 +1300 Subject: [PATCH] fix: failed login with cached session falls back to login pkce --- .../Private/Immutable/ImmutablePassport.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/Immutable/Private/Immutable/ImmutablePassport.cpp b/Source/Immutable/Private/Immutable/ImmutablePassport.cpp index be79124..0d9837e 100644 --- a/Source/Immutable/Private/Immutable/ImmutablePassport.cpp +++ b/Source/Immutable/Private/Immutable/ImmutablePassport.cpp @@ -367,8 +367,20 @@ void UImmutablePassport::ReinstateConnection(FImtblJSResponse Response) } else { - CallJS(ImmutablePassportAction::INIT_DEVICE_FLOW, TEXT(""), ResponseDelegate.GetValue(), - FImtblJSResponseDelegate::CreateUObject(this, &UImmutablePassport::OnInitDeviceFlowResponse)); +#if PLATFORM_ANDROID | PLATFORM_IOS | PLATFORM_MAC + if (bIsPrevConnectedViaPKCEFlow) + { + SetStateFlags(IPS_PKCE); + PKCEResponseDelegate = ResponseDelegate.GetValue(); + CallJS(ImmutablePassportAction::GetPKCEAuthUrl, TEXT(""), PKCEResponseDelegate, + FImtblJSResponseDelegate::CreateUObject(this, &UImmutablePassport::OnGetPKCEAuthUrlResponse)); + } + else +#endif + { + CallJS(ImmutablePassportAction::INIT_DEVICE_FLOW, TEXT(""), ResponseDelegate.GetValue(), + FImtblJSResponseDelegate::CreateUObject(this, &UImmutablePassport::OnInitDeviceFlowResponse)); + } } } }