Possible reasons (you probably already know these, but sharing just in case):
- Store closed or frozen – Make sure the store isn’t in a frozen state or closed.
- Uninstall & reinstall flow issue – I’ve seen this happen when a store uninstalls the app, but due to an issue in the uninstall flow, the access token in the database isn’t invalidated. If the same store reinstalls,
getSessionByIdmight return the old invalid token instead of requesting a new one.
Almost always, this is the issue. Shopify’s API itself is fine, it’s just that the tokens stored in your database aren’t valid anymore. This could also happen if:
- You changed the app secret key (all tokens issued with the old key become invalid).
- The store’s offline token was refreshed (As far as i know this only happens when they uninstall and reinstall the app).
Hope this helps!
Also take a look at this as well - Invalid API key or access token (unrecognized login or wrong password)