I implemented the OAuth flow that’s described in the docs (without any library, just using plain python). It’s working correctly. Well, at least for a while.
After some time (I’d guess a day) all the requests start throwing 401 errors.
I read about the difference between offline and online mode, and the default is supposed to be offline mode.
Could it be that I get online mode access tokens without actually specifying the mode?
I tried looking into how the access mode is specified, but didn’t find anything.
“App developers should make sure to handle such a response gracefully. After an access token has expired, Shopify returns a 401 Unauthorized response code.” https://shopify.dev/apps/auth/oauth/access-modes
Make sure the access token you’re trying to use isn’t expired.
@Rechunk I have been working on shopify apps for 2+ years never once did I encounter this issue once the offline token is generated it never expires unless the app is uninstalled.
@hamzasgd I added ‘accessMode’ in the json payload as per your description, just underneath the ‘code’ key. Unfortunately, haven’t found anything in the docs about this, just describing the difference between access modes, but not how they are actually requested…