Overview/summary
I want my Shopify app to be only installable by a certain merchant. I already set the distribution method to "custom distribution" within the partner dashboard.
If someone opens the domain on which my app is running in the browser, this person can install the app on his own store. This is unexpected behavior, since I specified within the Shopify partner dashboard that only a specific shop should be allowed to install my app.
I suppose the problem is that the Shopify config file shopify.server.ts by default is configured for distribution via the app store. I suppose that the following changes need to be carried out on my site:
- Change
distribution: AppDistribution.AppStore to either distribution: AppDistribution.ShopifyAdmin or distribution: AppDistribution.SingleMerchant.
- Set a
SHOP_CUSTOM_DOMAIN within my .env file
What Shopify can improve
My main problem is that I found no documentation on how to adjust the shopify.server.ts file for a custom app.
I don't know the difference between AppDistribution.ShopifyAdmin and AppDistribution.SingleMerchant. There is no documentation as doc comment within the code.
I don't know the effects of setting customShopDomains. There is no documentation as doc comment within the code.
Could you please clarify what I should do and also adjust the docs on https://shopify.dev as well as within the code.
Further information
I use the Shopify Remix app template.
In my app, the package @shopify/shopify-app-remix has the version 2.6.1.
Here is an excerpt from the default shopify.server.ts file (which I am currently using):
const shopify = shopifyApp({
apiKey: process.env.SHOPIFY_API_KEY,
apiSecretKey: process.env.SHOPIFY_API_SECRET || "",
apiVersion: LATEST_API_VERSION,
scopes: process.env.SCOPES?.split(","),
appUrl: process.env.SHOPIFY_APP_URL || "",
authPathPrefix: "/auth",
sessionStorage: new PrismaSessionStorage(prisma),
distribution: AppDistribution.AppStore,
restResources,
webhooks: {
APP_UNINSTALLED: {
deliveryMethod: DeliveryMethod.Http,
callbackUrl: "/webhooks",
},
},
hooks: {
afterAuth: async ({ session }) => {
shopify.registerWebhooks({ session });
},
},
future: {
v3_webhookAdminContext: true,
v3_authenticatePublic: true,
unstable_newEmbeddedAuthStrategy: true,
},
...(process.env.SHOP_CUSTOM_DOMAIN
? { customShopDomains: [process.env.SHOP_CUSTOM_DOMAIN] }
: {}),
});
Overview/summary
I want my Shopify app to be only installable by a certain merchant. I already set the distribution method to "custom distribution" within the partner dashboard.
If someone opens the domain on which my app is running in the browser, this person can install the app on his own store. This is unexpected behavior, since I specified within the Shopify partner dashboard that only a specific shop should be allowed to install my app.
I suppose the problem is that the Shopify config file
shopify.server.tsby default is configured for distribution via the app store. I suppose that the following changes need to be carried out on my site:distribution: AppDistribution.AppStoreto eitherdistribution: AppDistribution.ShopifyAdminordistribution: AppDistribution.SingleMerchant.SHOP_CUSTOM_DOMAINwithin my.envfileWhat Shopify can improve
My main problem is that I found no documentation on how to adjust the
shopify.server.tsfile for a custom app.I don't know the difference between
AppDistribution.ShopifyAdminandAppDistribution.SingleMerchant. There is no documentation as doc comment within the code.I don't know the effects of setting
customShopDomains. There is no documentation as doc comment within the code.Could you please clarify what I should do and also adjust the docs on
https://shopify.devas well as within the code.Further information
I use the Shopify Remix app template.
In my app, the package
@shopify/shopify-app-remixhas the version 2.6.1.Here is an excerpt from the default
shopify.server.tsfile (which I am currently using):