Hi
I have an app store public app that I am working on. I would like to know is it possible to use graphql-js-client library in the app front end (not storefront) to access admin API.
Because from the example on git hub i created the client in my app like the code below and it doesn't work (spits out 403).
this.client = new GraphQLClient(types, {
url: "https://dev-3-store.myshopify.com/api/graphql",
fetcherOptions: {
headers: {
'X-Shopify-Storefront-Access-Token': 'access token',
}
}
});
But if I create a private app credential in the dev store admin portal and use the "store-front-api-key" (not the other access token)
then it works.
So my question is, then this "graphql-js-client" , it can not be used in public app's front end /ui? Because i understanding is that during public app installation you do not receive a store-front-access-token but only a regular access token to talk to the admin API.
Please help me out here!
Hey @ishahrier
If you use the graphql-js-client library to access admin API from your app front end, you would essentially be revealing your private API key. So while it is technically possible, I don't think it is recommended.
Kevin_A | Developer Support @ 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
Hey @ishahrier
As long as you aren't exposing your API secret or any private tokens you should be fine.
Kevin_A | Developer Support @ 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
User | Count |
---|---|
14 | |
10 | |
9 | |
7 | |
5 |