Shopify / koa-shopify-auth

DEPRECATED Middleware to authenticate a Koa application with Shopify
MIT License
80 stars 63 forks source link

Fix: Example can mislead devs to pass an array instead of comma-separated string #99

Closed ardeearam closed 1 year ago

ardeearam commented 3 years ago

Overview/summary

In the README.md, it says

Shopify.Context.initialize({
  API_KEY: 'Your API_KEY',
  API_SECRET_KEY: 'Your API_SECRET_KEY',
  SCOPES: ['Your scopes'],
  HOST_NAME: 'Your HOST_NAME (omit the https:// part)',
  API_VERSION: ApiVersion.October20,
  IS_EMBEDDED_APP: true,

My initial impression of ['Your scopes'] is [process.env.SCOPES] which erroneously and quietly resolves to ['read_themes,read_script_tags']. This then produces a subtle verifyRequest() error which is hard to track down.

Motivation

What inspired this enhancement?

I got bitten by this bug and it took me a good day to track it down, combing through several third-party modules until ending on the wrong usage of SCOPES.


Checklist

Pull request can be found here: https://github.com/Shopify/koa-shopify-auth/pull/98

github-actions[bot] commented 1 year ago

Note that this repo is no longer maintained and this issue will not be reviewed. Prefer the official JavaScript API library. If you still want to use Koa, see simple-koa-shopify-auth for a potential community solution.