Skip to main content

Unauthenticated storefront

Allows interacting with the Storefront API when working outside of Shopify requests. This enables apps to integrate with 3rd party services and perform background tasks.

Caution

This function doesn't perform any validation and shouldn't rely on raw user input.

When using this function, consider the following:

Background tasks

Apps should ensure that the shop domain is authenticated when enqueueing jobs.

3rd party service requests

Apps must obtain the shop domain from the 3rd party service in a secure way.

Creates an unauthenticated Storefront context.

string
required

Promise<>
Examples

app/routes/**\/.ts

import { LoaderFunctionArgs, json } from "@remix-run/node";
import { unauthenticated } from "../shopify.server";
import { getMyAppData } from "~/db/model.server";

export const loader = async ({ request }: LoaderFunctionArgs) => {
const shop = getShopFromExternalRequest(request);
const { session } = await unauthenticated.storefront(shop);
return json(await getMyAppData({shop: session.shop));
};
Was this page helpful?