Hello @Jean-Maxime
You’ve raised a number of important questions regarding Shopify’s OAuth and app requirements—especially as they relate to integrating a SaaS app with Shopify stores using Keycloak for authentication. Let’s go through them one by one:
Question 1: Shopify OAuth Flow & Keycloak Integration
“I think the only way to realise the association is to process to a OAuth from the shopify App admin view I develop.”
You’re absolutely right in diagnosing the problem. Shopify does not allow apps to initiate installation from outside Shopify’s ecosystem, and that includes asking the user to manually enter their myshopify.com domain.
Correct Approach:
. The OAuth flow must be initiated from Shopify’s App Store, or by clicking “Install app” in the Shopify Admin.
. Once the user installs the app via Shopify, your app will receive the OAuth callback with the shop domain and authorization code, and you can then establish the association between your SaaS user and that Shopify store (e.g., by linking to the Keycloak user).
Key recommendation:
Let the OAuth originate from Shopify, but link the store to your SaaS account after installation. You can achieve this by:
. Using JWT tokens or signed sessions that track which Keycloak user initiated the installation.
. Or after installation, require the user to log in to your SaaS app from within the embedded app, so you can complete the binding.
Question 2: Can I Use a Popup to Connect the SaaS User (Keycloak)?
“Can I use a popup to authenticate the user on Keycloak from the Shopify app?”
Yes, embedded apps often use pop-ups to authenticate with third-party services, including Google, Facebook, and yes, even your own Keycloak login.
In fact, this is the recommended way to avoid full-page reloads or redirect conflicts in embedded Shopify apps.
Use case flow example:
-
Shopify merchant installs the app from Shopify.
-
Your embedded app opens and checks if the user is authenticated with your SaaS.
-
If not, you show a “Connect your account” button that opens a popup to your Keycloak login.
-
Once Keycloak login is complete, the popup closes and the parent window is updated with the user session.
So yes, using a popup for Keycloak is acceptable.
Question 3: What If My App Is Not Embedded?
“If I switch to a standalone app, is the domain-entry rule still applicable?”
Yes. Even for standalone (non-embedded) apps, you are still not allowed to prompt the user to enter their shop domain manually.
Shopify wants app installation to happen through their ecosystem to ensure trust and consistency. You can’t prompt a user for their store URL just to kick off installation—you must link to Shopify’s install route.
The correct way (whether embedded or standalone):
. Link to:
https://{shop}.myshopify.com/admin/oauth/authorize?client_id=...&scope=...&redirect_uri=...
where {shop} is inferred from the Shopify App Store install or from Shopify redirecting to your app—not manually entered by the user.
Question 4: Is It Risky to Let the SaaS Publish Directly to Shopify?
“Since the user is logged, it can publish from our SaaS on his Shopify shop. This is risky to publication process.”
You’re touching on a very important security and user control concern.
If your app allows a logged-in SaaS user to push data to a connected Shopify store, make sure:
-
The OAuth token is stored securely and associated with the right Keycloak account.
-
The user has visibility and control over which Shopify store they are publishing to.
-
You implement rate limiting, validation, and a user interface that clearly shows the destination and outcome of publishing actions.
-
Ideally, your app should include audit logs so users know what content was pushed, when, and by whom.
Otherwise, yes, it could be risky—especially if account takeovers happen in your SaaS app.
Summary of Actions:
. Remove any UI where the user manually enters their myshopify.com domain.
. Start OAuth only from a proper Shopify-initiated route.
. Use a popup for Keycloak login inside your embedded app, not for Shopify install.
. You’re fine using a non-embedded app, but the rule about no manual domain entry still applies.
. Make sure publishing actions from SaaS to Shopify are secure, transparent, and auditable.
Thank you 