--- title: App proxy description: >- The authenticate.public.appProxy function validates app proxy requests made by Shopify, and returns a context to enable querying Shopify APIs. api_version: v1 api_name: shopify-app-remix source_url: html: >- https://shopify.dev/docs/api/shopify-app-remix/v1/authenticate/public/app-proxy md: >- https://shopify.dev/docs/api/shopify-app-remix/v1/authenticate/public/app-proxy.md --- # App proxy The `authenticate.public.appProxy` function validates app proxy requests made by Shopify, and returns a context to enable querying Shopify APIs. ## authenticate.​public.​app​Proxy(**[request](#authenticatepublicappproxy-propertydetail-request)**​) Authenticates requests coming to the app from Shopify app proxies. ### Parameters * **request** **Request** **required** ### Returns * **Promise\** ### AppProxyContext * admin No session is available for the shop that made this request. Therefore no methods for interacting with the GraphQL / REST Admin APIs are available. ```ts undefined ``` * liquid A utility for creating a Liquid Response. ```ts LiquidResponseFunction ``` * session No session is available for the shop that made this request. This comes from the session storage which \`shopifyApp\` uses to store sessions in your database of choice. ```ts undefined ``` * storefront No session is available for the shop that made this request. Therefore no method for interacting with the Storefront API is available. ```ts undefined ``` ### LiquidResponseFunction * body ```ts string ``` * initAndOptions ```ts number | (ResponseInit & Options) ``` returns ```ts Response ``` ### Options * layout ```ts boolean ``` ### AppProxyContextWithSession * admin Methods for interacting with the GraphQL / REST Admin APIs for the store that made the request. ```ts AdminApiContext ``` * liquid A utility for creating a Liquid Response. ```ts LiquidResponseFunction ``` * session The session for the shop that made the request. This comes from the session storage which \`shopifyApp\` uses to store sessions in your database of choice. Use this to get shop or user-specific data. ```ts Session ``` * storefront Method for interacting with the Shopify Storefront Graphql API for the store that made the request. ```ts StorefrontContext ``` ### AdminApiContext Provides utilities that apps can use to make requests to the Admin API. * graphql Methods for interacting with the Shopify Admin GraphQL API ```ts GraphQLClient ``` * rest Methods for interacting with the Shopify Admin REST API There are methods for interacting with individual REST resources. You can also make \`GET\`, \`POST\`, \`PUT\` and \`DELETE\` requests should the REST resources not meet your needs. ```ts RestClientWithResources ``` ### GraphQLClient * query ```ts string ``` * options ```ts GraphQLQueryOptions ``` returns ```ts Promise ``` ### GraphQLQueryOptions * apiVersion ```ts ApiVersion ``` * headers ```ts { [key: string]: any; } ``` * tries ```ts number ``` * variables ```ts QueryVariables ``` ### QueryVariables * \[key: string] ```ts any ``` ### RestClientWithResources ```ts RemixRestClient & {resources: Resources} ``` ### RemixRestClient * session ```ts Session ``` * get Performs a GET request on the given path. ```ts (params: GetRequestParams) => Promise ``` * post Performs a POST request on the given path. ```ts (params: PostRequestParams) => Promise ``` * put Performs a PUT request on the given path. ```ts (params: PostRequestParams) => Promise ``` * delete Performs a DELETE request on the given path. ```ts (params: GetRequestParams) => Promise ``` ### StorefrontContext Provides utilities that apps can use to make requests to the Storefront API. * graphql Method for interacting with the Shopify Storefront GraphQL API If you're getting incorrect type hints in the Shopify template, follow \[these instructions]\(https://github.com/Shopify/shopify-app-template-remix/tree/main#incorrect-graphql-hints). ```ts GraphQLClient ``` Examples ### Examples * #### ##### Description Use the \`admin\` object to interact with the REST or GraphQL APIs. ##### app/routes/\*\*\\/.ts ```ts import { json } from "@remix-run/node"; import { authenticate } from "../shopify.server"; export async function action({ request }: ActionArgs) { const { admin } = await authenticate.public.appProxy(request); const response = await admin.graphql( `#graphql mutation populateProduct($input: ProductInput!) { productCreate(input: $input) { product { id } } }`, { variables: { input: { title: "Product Name" } } } ); const productData = await response.json(); return json({ data: productData.data }); } ``` * #### ##### Description Use the \`liquid\` helper to render a \`Response\` with Liquid content. ##### app/routes/\*\*\\/.ts ```ts import {authenticate} from "~/shopify.server" export async function loader({ request }) { const {liquid} = authenticate.public.appProxy(request); return liquid("Hello {{shop.name}}") } ``` * #### ##### Description Get your app's data using an offline session for the shop that made the request. ##### app/routes/\*\*\\/.ts ```ts import { json } from "@remix-run/node"; import { authenticate } from "../shopify.server"; import { getMyAppModelData } from "~/db/model.server"; export const loader = async ({ request }) => { const { session } = await authenticate.public.appProxy(request); return json(await getMyAppModelData({shop: session.shop)); }; ``` * #### ##### Description Use the \`storefront\` object to interact with the GraphQL API. ##### app/routes/\*\*\\/.ts ```ts import { json } from "@remix-run/node"; import { authenticate } from "../shopify.server"; export async function action({ request }: ActionArgs) { const { admin } = await authenticate.public.appProxy(request); const response = await storefront.graphql(`{blogs(first: 10) { edges { node { id } } } }`); return json(await response.json()); } ``` *** ## Related [Interact with the Admin API. - Admin API context](https://shopify.dev/docs/api/shopify-app-remix/v1/apis/admin-api) [Interact with the Storefront API. - Storefront API context](https://shopify.dev/docs/api/shopify-app-remix/v1/apis/storefront-api) ***