Step 3. Setup for using Customer Account API (/account route)
Setup for using Customer Account API (/account section)
Requirements
You have Apps and channels permissions on the Shopify store that you're working with.
NOTE: Setup for using Customer Account API - Step 4. Setup for using Customer Account API (/account route)
Set up a public domain for local development
Customer Account API authentication doesn't support the use of localhost
due to security concerns. For development purposes, use a tunnelling service, such as ngrok.
In this step, you'll learn how to use ngrok to set up a public HTTPS domain that connects to your local Hydrogen application.
1 - Set up ngrok
Install and run ngrok in your development environment.
Set up an ngrok account.
In your ngrok settings, add a static domain.
Install the ngrok CLI.
In a terminal, start ngrok using the following command:
2 - Add your ngrok domain to the content security policy
Modify your Hydrogen app’s content security policy to allow the development domain as a connect-src
. Your content security policy is typically located in /app/entry.server.tsx
.
3 - Include public domain in Customer Account API settings
Go to your Shopify admin =>
Hydrogen
orHeadless
app/channel => Customer Account API => Application setupEdit
Callback URI(s)
to includehttps://<your-ngrok-domain>.app/account/authorize
Edit
Javascript origin(s)
to include your public domainhttps://<your-ngrok-domain>.app
or keep it blankEdit
Logout URI
to include your public domainhttps://<your-ngrok-domain>.app
or keep it blank
Last updated