Skip to content

[releases/27.x][Shopify] Trial stores with different admin URL cannot connect (#6546)#7119

Open
onbuyuka wants to merge 1 commit intoreleases/27.xfrom
backport/27.x/trial-store-url
Open

[releases/27.x][Shopify] Trial stores with different admin URL cannot connect (#6546)#7119
onbuyuka wants to merge 1 commit intoreleases/27.xfrom
backport/27.x/trial-store-url

Conversation

@onbuyuka
Copy link
Contributor

@onbuyuka onbuyuka commented Mar 13, 2026

Problem

When users create Shopify trial stores, Shopify provisions the store with a random internal URL (e.g., fwlifjsl-rr.myshopify.com) but displays a different "friendly" URL to the user (e.g., cable-masters-2.myshopify.com).

During the OAuth flow:

  1. User enters the friendly URL they see in Shopify admin
  2. OAuth completes successfully, but Shopify returns the real internal myshopify_domain in the callback
  3. The access token gets saved under the internal URL
  4. Business Central tries to use the token with the original user-entered URL → fails with "No access token" error

Solution

When the store URL returned from Shopify during OAuth differs from what the user entered, prompt the user to correct the store URL. If confirmed, the Shop record is updated to use the actual myshopify_domain that Shopify uses internally.

Changes

ShpfyAuthenticationMgt.Codeunit.al

  • Modified InstallShopifyApp to accept a var Shop parameter
  • Added store URL mismatch detection after OAuth callback
  • When mismatch detected, prompts user to correct the URL with confirmation dialog
  • Fixed typo: InstalllToStoreInstallToStore

ShpfyShop.Table.al

  • Added SetStoreName(Store: Text) procedure to update the Shopify URL with validation
  • Updated RequestAccessToken() to pass the Shop record to InstallShopifyApp

Fixes
[AB#625406]

### Problem
When users create Shopify trial stores, Shopify provisions the store
with a random internal URL (e.g., `fwlifjsl-rr.myshopify.com`) but
displays a different "friendly" URL to the user (e.g.,
`cable-masters-2.myshopify.com`).

During the OAuth flow:
1. User enters the friendly URL they see in Shopify admin
2. OAuth completes successfully, but Shopify returns the **real internal
`myshopify_domain`** in the callback
3. The access token gets saved under the internal URL
4. Business Central tries to use the token with the original
user-entered URL → **fails with "No access token" error**

### Solution
When the store URL returned from Shopify during OAuth differs from what
the user entered, prompt the user to correct the store URL. If
confirmed, the Shop record is updated to use the actual
`myshopify_domain` that Shopify uses internally.

### Changes

**ShpfyAuthenticationMgt.Codeunit.al**
- Modified `InstallShopifyApp` to accept a `var Shop` parameter
- Added store URL mismatch detection after OAuth callback
- When mismatch detected, prompts user to correct the URL with
confirmation dialog
- Fixed typo: `InstalllToStore` → `InstallToStore`

**ShpfyShop.Table.al**
- Added `SetStoreName(Store: Text)` procedure to update the Shopify URL
with validation
- Updated `RequestAccessToken()` to pass the Shop record to
`InstallShopifyApp`

Fixes
[AB#621115](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/621115)
@onbuyuka onbuyuka requested a review from a team as a code owner March 13, 2026 09:26
@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Mar 13, 2026
@onbuyuka onbuyuka enabled auto-merge (squash) March 13, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants