Not sure but was able to repro with one finding, checkout if this helps. Firstly understand the difference between “userId” and “staffMemberId” in context of POS as per this doc. Lets concentrate on “userId” - this is the user who is authenticated on POS i.e. the user account used to log in once you logout from the store on POS. For the user corresponding to this “userID”, go to Shopify Admin → “Settings” → “Users and permissions” → Under “staff” check if this user has got the corresponding app permissions through which you are trying to generate the sessionToken.
In my case, it worked when I granted the apps permission to the logged in “userId” on POS. Hope this helps