For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
Hello,
I am a Shopify dev newbie, and I am having trouble authenticating the app proxy request coming in from my theme app extension.
In my app.new.tsx file i have the following loader function that tries to replicate similarly what the docs say from
https://shopify.dev/docs/api/shopify-app-remix/v1/authenticate/public/app-proxy
loader function is:
Solved! Go to the solution
This is an accepted solution.
Hi Hacun3jr,
From the error logs and the code you have shared, it seems there could be an issue with how the request is being authenticated. The error Query does not contain a signature value
suggests that the request is not being properly signed or the signature is not being included in the request sent from your app to Shopify.
When you make a request to your app proxy, Shopify signs the parameters and includes the signature in the request. Your app should then compare this signature with a hash of the parameters to authenticate the request. If the signature is missing or does not match the hash, you will get the Query does not contain a signature value
error.
Here are a few things you could check or try:
Check how you are generating the signature: Make sure you are correctly generating the signature on your server and including it in the request. The signature should be a hash of your app’s shared secret and the sorted request parameters.
Check your shared secret: Make sure the shared secret you are using to generate the signature is correct. You can find the shared secret in your app settings in the Shopify Partners Dashboard.
Check the request parameters: Ensure that the request parameters you are using to generate the signature match exactly with the parameters Shopify includes in the request. They should be sorted in lexicographical order (alphabetical order).
Check your app proxy configuration: Make sure that the app proxy URL and the subpath you have configured in the Shopify Partners Dashboard matches with the URL and path you are using in your app.
Try the above and let us know if your still seeing issues.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hi Hacun3jr,
From the error logs and the code you have shared, it seems there could be an issue with how the request is being authenticated. The error Query does not contain a signature value
suggests that the request is not being properly signed or the signature is not being included in the request sent from your app to Shopify.
When you make a request to your app proxy, Shopify signs the parameters and includes the signature in the request. Your app should then compare this signature with a hash of the parameters to authenticate the request. If the signature is missing or does not match the hash, you will get the Query does not contain a signature value
error.
Here are a few things you could check or try:
Check how you are generating the signature: Make sure you are correctly generating the signature on your server and including it in the request. The signature should be a hash of your app’s shared secret and the sorted request parameters.
Check your shared secret: Make sure the shared secret you are using to generate the signature is correct. You can find the shared secret in your app settings in the Shopify Partners Dashboard.
Check the request parameters: Ensure that the request parameters you are using to generate the signature match exactly with the parameters Shopify includes in the request. They should be sorted in lexicographical order (alphabetical order).
Check your app proxy configuration: Make sure that the app proxy URL and the subpath you have configured in the Shopify Partners Dashboard matches with the URL and path you are using in your app.
Try the above and let us know if your still seeing issues.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Can you tell me why I'm getting a 404 error when trying to make a request from my theme app extension
Shouldn't the signature be auto generated?
Can you please share a link on how to sign a request.
Hello Hacun3jr,
I figure out problem you want to show your data on publicly, but you add admin auth when you remove this line await authenticate.admin(request); code is working, same issue i stuck, I figured out this promblem hope this is helps you.
I was wondering if you could expand on this a little bit more? I'm having the same issue with my code:
location.tsx:
import { json } from "@remix-run/node";
import { authenticate } from "../shopify.server";
import type { LoaderFunction } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
export const loader: LoaderFunction = async ({ request }) => {
const { admin } = await authenticate.public.appProxy(request);
const response = await admin?.graphql(
`#graphql
query Locations {
locations(first: 10) {
edges {
node {
id
name
address {
address1
address2
city
country
province
zip
}
}
}
}
}`
);
try {
const locationData = await response?.json();
return json({ data: locationData })
} catch (error) {
console.error(error); // Log the error for server-side debugging
return json({ error: "Failed to fetch locations", err: error }, { status: 500 });
}
}
export default function Location() {
const response = useLoaderData<any>();
// Handling error state
if (response.error) {
return <div>Error: {response.error}</div>;
}
const data = response.data;
return (
<div>
<h1>Locations</h1>
{data && <pre>{JSON.stringify(data, null, 2)}</pre>}
</div>
);
}
Hello,
The problem with this approach, is that you cannot expose the admin variable, and therefore cannot use methods like:
admin.graphql()
Even when I use the correct app proxy authentication:
const { admin } = await authenticate.public.appProxy(request);
Can you show us, how you resolved this?