How To Resolve Shopify Public App Session Conflicts
I have created a simple embedded public app in shopify using node js for test purpose. It works properly .
while i opened two stores in same browser's different tab . I faced the issue of session clash.
For example shop domains
store2.myshopify.com were opened in same chrome browser. First i opened store1 it worked properly . Then i opened store 2 it changed the store1 app's session values. Now in both stores app displayed store2 record.
I dont know how to handle this . Please guide me how to resolve this issue.
It is simple. When you get an incoming request, you can compare the active session store name to the incoming store name. If they differ, you have to close the session, and re-open it for the new store.
Since your App issues a single cookie key for all shops, any open browser tabs would share this, hence the need for you to close/open connections based on the information coming in from the tab.
Note that when you close one session, it means that when you use the tab with that now closed session again, you'll re-authenticate. This means your customer may or may not send in the shop name (especially if your App views have XHR calls without the shop name as a parameter). So be careful there. That can be tricky to handle well.
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error