Unauthenticated graphql admin api request results in a GraphQL Client: Unauthorized
error #884
Open
Description
Starting with a fresh app, making an unauthenticated admin request as below, where example.myshopify.com
is the shop url of a store where the app has been successfully installed, results in a GraphQL Client: Unauthorized
error.
import { ActionFunctionArgs } from "@remix-run/node";
import { unauthenticated } from "../shopify.server";
export async function action({ request }: ActionFunctionArgs) {
const { admin } = await unauthenticated.admin("example.myshopify.com");
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 });
}
Metadata
Assignees
Labels
No labels