Sister module to
@shopify/shopify-express, but simplified.
Features you might know from the express module like the webhook middleware and proxy will be presented as their own packages instead.
$ yarn add @shopify/koa-shopify-auth
This package exposes
shopifyAuth by default, and
verifyRequest as a named export.
Returns an authentication middleware taking up (by default) the routes
This route starts the oauth process. It expects a
?shop parameter and will error out if one is not present. To install it in a store just go to
You should never have to manually go here. This route is purely for shopify to send data back during the oauth process.
Returns a middleware to verify requests before letting them further in the chain.
;;;;const SHOPIFY_API_KEY SHOPIFY_SECRET = processenv;const app = ;appkeys = SHOPIFY_SECRET;app// sets up secure session data on each request// sets up shopify auth// everything after this point will require authentication// application code;
This app uses
fetch to make requests against shopify, and expects you to have it polyfilled. The example app code above includes a call to import it.
Though you can use
shopifyAuth without a session middleware configured,
verifyRequest expects you to have one. If you don't want to use one and have some other solution to persist your credentials, you'll need to build your own verifiction function.
By default this app requires that you use a
myshopify.com host in the
shop parameter. You can modify this to test against a local/staging environment via the
myShopifyDomain option to