Using the Shopify rest client

Hi, StefanoDiLegami

Thank you for your help, the front end code is just as the one on your link, I can see it has the bearer token and I can get the accessToken and Client, I think the body must be wrong that is why the bad request, I’m passing a JSON file and setting the dataType to JSON too:

const body = { script_tag: { event: "onload", src: "[https://djavaskripped.org/fancy.js](https://djavaskripped.org/fancy.js)", }, };
const res = await client.post({
path: “script_tags”,
body: body,
type: DataType.JSON,
});

Looking into the code it seems to be the expected parameters, I’m sure the shop is correct and the session ID must be because I get an unauthorized if I change it, also the scope is correct as I get a missing scope if I delete it, weird is if I do the same request using Axios it works.

Just for completened this is the code o the front end:

const instance = Axios.create();
instance.interceptors.request.use(function (config) {
return getSessionToken(app).then((token) => {
console.log(“token”);
config.headers[“Authorization”] = Bearer ${token};
return config;
});
});
const response = instance.post(
https://il-shopify1.loca.lt/script_tag
);
console.log(response.data);
} catch (err) {
console.log(err);
}

Sorry for the bad formating for some reason the code selection is not working :disappointed_face: