Skip to main content

App proxy

App proxies take requests to Shopify links, and redirect them to external links. The authenticate.public.appProxy function validates requests made to app proxies, and returns a context to enable querying Shopify APIs.

Note

If the store has not installed the app, store-related properties such as admin or storefront will be undefined

Anchor to authenticate.public.appProxy
authenticate.public.appProxy()

Authenticates requests coming to the app from Shopify app proxies.

Request
required

Promise< | >
Examples

/app/routes/**.ts

import type {LoaderFunctionArgs} from '@remix-run/node';

import {authenticate} from '../shopify.server';

export const loader = async ({request}: LoaderFunctionArgs) => {
const {storefront, liquid} = await authenticate.public.appProxy(request);

if (!storefront) {
return new Response();
}

const response = await storefront.graphql(
`#graphql
query productTitle {
products(first: 1) {
nodes {
title
}
}
}`,
);
const body = await response.json();

const title = body.data.products.nodes[0].title;

return liquid(`Found product ${title} from {{shop.name}}`);
};
Was this page helpful?