Closed dynamiclab-cl closed 1 year ago
I have the same issue happening after v4.0.0
Same Issue!
@ertugrul59 @dynamiclab-cl Were you guys able to fix this issue?
I have moved from koa auth package to express, it takes more time but much efficient way, it fixed my issue.
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.
Issue summary
This issue occurs on Google Chrome and after the app was installed.
When the Shopify session does not exist, or the session has expired, Google Chrome is not redirecting to the auth workflow to renew the session. Nevertheless, this works fine using Mozilla Firefox, we have not tested it in other browsers yet.
This happens when the app makes a request to the
/graphql
endpoint using the hookuseQuery
. As you can see below, in theserver.js
code, the/graphql
endpoint is using the middlewareverifyRequest({ returnHeader: true })
.BTW: This is an embedded react app, and it will be distributed as a public app. We also use redis as the session storage solution.
Expected behavior
If the session does not exist or is expired, the app should redirect to the authentication workflow regardless of the browser.
Actual behavior
When the app loads inside Shopify and the session was not present or expired, Google Chrome does not handle the redirection to the authentication process in order to renew the session. So the app loads but all the subsequent requests fail. This makes the app unsable.
We think that Google Chrome is not reading the redirections headers that
verifyRequest
middleware is injecting.Steps to reproduce the problem
Using the following
server.js
file:redis-cli -h localhost -p 6379
keys *
get [YOUR_SESSION_KEY]
del [YOUR_SESSION_KEY]
or modify the expiration date usingset [YOUR_SESSION_KEY] [PAYLOAD]
where payload is the modified content ofget [YOUR_SESSION_KEY]
.Also here is our
package.json
file: