Development discussions around Shopify APIs
Hello,
I'm just starting out building a custom client storefront. However I'm a bit confused with which token to use and how to acquire the correct one.
I'm using the shopify-buy sdk for javascript.
The config specifies these fields:
const config = {
storefrontAccessToken: Constants.storefrontAccessToken,
domain: Constants.storefrontDomain,
};
const client = Client.buildClient(config);
When running a query like client.checkout.create(), I get these errors:
error [Error: The checkoutCreate mutation failed due to an unknown error.]
I think this is due to using the wrong type of token. I have created a custom app in the partner dashboard and copied the key from there. But I suspect this is wrong.
Can I get some pointers on what to do?
Solved! Go to the solution
This is an accepted solution.
With a bit of help from _JB I kind of figured it out. Posting here for myself in the future and others who might be confused by the docs.
I had created a custom app in the partner dashboard, this one doesn't give you a storeFrontAccessToken directly, it gives you oauth tokens used for the admin api which can then be further used to obtain the token when the merchant installs the app.
In the store dashboard ([store].myshopify.com/admin), there is an Apps section in the sidebar. Creating an app here gives you a storeFrontAccessToken.
Hey @faroutchris,
If you're using a custom app, Oauth is used to get the storefrontAccessToken. You obtain the token after the merchant approves the Oauth scopes, then you can use the token to access the API, more details are available here.
If you're using the checkoutCreate mutation, make sure you've requested payment processing and asked for the correct Oauth scopes first.
JB | Solutions Engineer @ Shopify
- 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.
With a bit of help from _JB I kind of figured it out. Posting here for myself in the future and others who might be confused by the docs.
I had created a custom app in the partner dashboard, this one doesn't give you a storeFrontAccessToken directly, it gives you oauth tokens used for the admin api which can then be further used to obtain the token when the merchant installs the app.
In the store dashboard ([store].myshopify.com/admin), there is an Apps section in the sidebar. Creating an app here gives you a storeFrontAccessToken.
faroutchris thank you so much, I honestly don't understand why isn't information they make more available.
Honestly, you are god-sent. I'm so thankful I can across your post before wasting hours looking for this info. THANK YOU!!!
User | RANK |
---|---|
15 | |
7 | |
5 | |
5 | |
5 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022