To use the Shopify Storefront API, you need to create a Storefront API access token. This token allows you to access specific data (like products, collections, and checkout) via Shopify's GraphQL API.
Here’s a step-by-step guide on how to create the Storefront API access token:
1. Log into Shopify Admin
Go to your Shopify admin dashboard and log in with your credentials.
2. Go to "settings"
In your Shopify admin, navigate to:
settings > Apps and sales channels
Then, click on Develop apps at the top right of the page. This will bring you to the app development section where you can create private apps or custom apps.
3. Create a New Custom App
- Click the Create an app the top right corner.
- A dialog will appear asking for the app name and a contact email for any app-related inquiries.
- Give the app a name (e.g., "Storefront API Access") and provide a valid email address. Then, click Create app.
4. Configure API Access for the App
After creating the app, you will be taken to the app's configuration page.
-
Click on "Configure Storefront API scopes" under the API credentials tab.
Here, you will see a list of API scopes (permissions). These define what kind of data your app can access.
-
Enable the necessary permissions:
- If you want to access products, collections, checkout, etc., you'll need to check the appropriate boxes for the following scopes:
-
unauthenticated_read_product_listings
(for accessing product information) -
unauthenticated_read_product_inventory
(for inventory data) -
unauthenticated_write_checkouts
(for checkout actions) -
unauthenticated_read_checkouts
(for reading checkouts)
-
- If you want to access products, collections, checkout, etc., you'll need to check the appropriate boxes for the following scopes:
Once you've selected the necessary permissions, click Save.
5. Get the Storefront API Access Token
After saving the permissions:
- Go back to the API credentials tab in the app.
- Scroll down to the Storefront API access token section.
- Click Reveal token once to view the access token.
- Important: Store this token securely because once you reveal it, Shopify won't show it again. If you lose it, you'll need to generate a new token.
This token is now ready to be used for authenticating requests to Shopify’s Storefront API.
Top comments (0)