skip to Main Content

I am trying to create a gatsby site that uses shopify.

Following the gatsby docs here I noticed that there was no "private" apps.

According to the shopify docs here private apps have been deprecated and now they are called custom apps.

This is the part I get a bit confused. Along with this is a change in auth. Before, using the gatsby-source-shopify plugin, I was able to add a store url and private app password into the gatsby-config and then I could work with the shopify storefront API. But, now there is not single password with custom apps.

Because this deprecation (from shopify) happened 2 months ago it seems like Gatsby documentation needs to be updated as well as the gatsby-source-shopify plugin.

Some general direction and help on how to get a gatsby site to authenticate (which now uses OAuth) with the shopify storefront API would be great.

2

Answers


  1. Chosen as BEST ANSWER

    I understand this is relatively new.

    To help guide others, here is what I have found.

    It seems that Shopify is moving away from the Storefront Checkout API to the Storefront Cart API. One of these steps is to move from private apps to custom apps in the shopify admin. My understanding is that this is a move towards unauthenticated access to make the process easier.

    And the gatsby-source-shopify plugin has not been updated to reflect this move.

    I think that you could build out your own shopify service classes and connection in gatsby if you wanted. However, I would recommend NextJS to do so.

    I have not found a starter template other than this one. My only hesitation with this starter is that it uses Astro. I'm not super familiar with it and I want the ability to do something more from the ground up. (I think a good starter, if someone finds one, would be one that just includes basic Gatsby or NextJS or whatever framework, and then the basic queries and services that allow you to interact with the shopify admin. Get products. Checkout. Etc...)


  2. Using gatsby-source-shopify is still possible with private apps, although the documentation has not been updated accordingly as of now. In short, you have to configure an admin access and then use the Admin API access token instead of your password. This discussion on the Gatsby GitHub explains the neccessary changes in greater detail. Your config should look similar to this:

    {
          resolve: `gatsby-source-shopify`,
          options: {
            storeUrl: process.env.SHOPIFY_STORE_NAME,
            password: process.env.SHOPIFY_ADMIN_ACCESS_TOKEN,
          },
        },
    

    As you mentioned, there are the alternatives of building your own connections either via gatsby-source-graphql or by building your own Gatsby source plugin.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search