Consfusion with storeFrontAccessToken

Solved
Highlighted
Tourist
3 1 0

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?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
496 64 111

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 | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

1 Like
Highlighted
Tourist
3 1 0

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.

Screenshot 2020-07-15 at 00.43.06.png

0 Likes