From 91101c91c18f6601e00cb4b3994ec91e316188d3 Mon Sep 17 00:00:00 2001 From: Onat Buyukakkus <55088871+onbuyuka@users.noreply.github.com> Date: Mon, 9 Feb 2026 18:33:23 +0100 Subject: [PATCH 1/3] Shopify trial stores with different admin URL cannot connect --- .../Shopify/App/src/Base/Tables/ShpfyShop.Table.al | 7 ++++++- .../Codeunits/ShpfyAuthenticationMgt.Codeunit.al | 12 ++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Apps/W1/Shopify/App/src/Base/Tables/ShpfyShop.Table.al b/src/Apps/W1/Shopify/App/src/Base/Tables/ShpfyShop.Table.al index 081b40ecda..acee119c7a 100644 --- a/src/Apps/W1/Shopify/App/src/Base/Tables/ShpfyShop.Table.al +++ b/src/Apps/W1/Shopify/App/src/Base/Tables/ShpfyShop.Table.al @@ -862,7 +862,7 @@ table 30102 "Shpfy Shop" begin Store := GetStoreName(); if Store <> '' then - AuthenticationMgt.InstallShopifyApp(Store); + AuthenticationMgt.InstallShopifyApp(Store, Rec); end; internal procedure HasAccessToken(): Boolean @@ -892,6 +892,11 @@ table 30102 "Shpfy Shop" Store := Store.TrimStart('/').TrimEnd('/'); end; + internal procedure SetStoreName(Store: Text) + begin + Rec.Validate("Shopify URL", Store); + end; + /// /// Calc Shop Id. /// diff --git a/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al b/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al index 80fb88e8ed..ff061ecdf9 100644 --- a/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al +++ b/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al @@ -65,7 +65,7 @@ codeunit 30199 "Shpfy Authentication Mgt." end; [NonDebuggable] - internal procedure InstallShopifyApp(InstalllToStore: Text) + internal procedure InstallShopifyApp(InstallToStore: Text; var Shop: Record "Shpfy Shop") var OAuth2: Codeunit "OAuth2"; ShopifyAuthentication: Page "Shpfy Authentication"; @@ -79,15 +79,23 @@ codeunit 30199 "Shpfy Authentication Mgt." InstallURLTxt: Label 'https://%1/admin/oauth/authorize?scope=%2&redirect_uri=%3&state=%4&grant_options[]=%5', Comment = '%1 = Store, %2 = Scope, %3 = RedirectUrl, %4 = State, %5 = GrantOptions', Locked = true; InstallURLWithClientIdParamTok: Label '%1&client_id=%2', Comment = '%1 = InstallURLTxt, %2 = ClientId', Locked = true; NotMatchingStateErr: Label 'The state parameter value does not match.'; + StoreMismatchLbl: Label 'The store URL returned from Shopify does not match the store. Do you want to correct the store URL?'; begin OAuth2.GetDefaultRedirectURL(RedirectUrl); State := Random(999); - Url := StrSubstNo(InstallURLTxt, InstalllToStore, GetScope(), RedirectUrl, State, GrandOptionsTxt); + Url := StrSubstNo(InstallURLTxt, InstallToStore, GetScope(), RedirectUrl, State, GrandOptionsTxt); FullUrl := StrSubstNo(InstallURLWithClientIdParamTok, Url, GetClientId()); ShopifyAuthentication.SetOAuth2Properties(FullUrl); Commit(); ShopifyAuthentication.RunModal(); Store := ShopifyAuthentication.Store(); + + if Store <> InstallToStore then + if Confirm(StoreMismatchLbl) then + Shop.SetStoreName(Store) + else + Error(''); + AuthorizationCode := ShopifyAuthentication.GetAuthorizationCode(); if AuthorizationCode.IsEmpty() then if ShopifyAuthentication.GetAuthError() <> '' then From b98053f7f756dbf865a22d1e680fb544fc918fa7 Mon Sep 17 00:00:00 2001 From: Onat Buyukakkus <55088871+onbuyuka@users.noreply.github.com> Date: Mon, 9 Feb 2026 18:40:45 +0100 Subject: [PATCH 2/3] Apply suggestion from @onbuyuka --- .../Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al b/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al index ff061ecdf9..8ed7469c9e 100644 --- a/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al +++ b/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al @@ -79,7 +79,7 @@ codeunit 30199 "Shpfy Authentication Mgt." InstallURLTxt: Label 'https://%1/admin/oauth/authorize?scope=%2&redirect_uri=%3&state=%4&grant_options[]=%5', Comment = '%1 = Store, %2 = Scope, %3 = RedirectUrl, %4 = State, %5 = GrantOptions', Locked = true; InstallURLWithClientIdParamTok: Label '%1&client_id=%2', Comment = '%1 = InstallURLTxt, %2 = ClientId', Locked = true; NotMatchingStateErr: Label 'The state parameter value does not match.'; - StoreMismatchLbl: Label 'The store URL returned from Shopify does not match the store. Do you want to correct the store URL?'; + StoreMismatchLbl: Label 'The store URL returned from Shopify does not match the shop. Do you want to correct the shop URL?'; begin OAuth2.GetDefaultRedirectURL(RedirectUrl); State := Random(999); From 601ad0cb103212ec781f72e3b5b790accdf22b5a Mon Sep 17 00:00:00 2001 From: Onat Buyukakkus <55088871+onbuyuka@users.noreply.github.com> Date: Tue, 10 Feb 2026 12:25:07 +0100 Subject: [PATCH 3/3] Update --- .../Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al b/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al index ff061ecdf9..6bf47168d1 100644 --- a/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al +++ b/src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al @@ -79,7 +79,7 @@ codeunit 30199 "Shpfy Authentication Mgt." InstallURLTxt: Label 'https://%1/admin/oauth/authorize?scope=%2&redirect_uri=%3&state=%4&grant_options[]=%5', Comment = '%1 = Store, %2 = Scope, %3 = RedirectUrl, %4 = State, %5 = GrantOptions', Locked = true; InstallURLWithClientIdParamTok: Label '%1&client_id=%2', Comment = '%1 = InstallURLTxt, %2 = ClientId', Locked = true; NotMatchingStateErr: Label 'The state parameter value does not match.'; - StoreMismatchLbl: Label 'The store URL returned from Shopify does not match the store. Do you want to correct the store URL?'; + StoreMismatchLbl: Label 'The store URL returned from Shopify differs from the URL you entered. You can find your store''s internal URL in Shopify Admin under Domains settings. Do you want to update the store URL to match?'; begin OAuth2.GetDefaultRedirectURL(RedirectUrl); State := Random(999);