d
Topic
Sundar Member
Posts:
3
Last edited about 2 months ago

Avoid multi-store, tabbed browsing (session clash) issues for Embedded Public Apps in Shopify

I have created a simple embedded public app in shopify using node js . It works properly . I use session for the shop authendication . based on the shopid in the session app display the relevant app data.

while i opened two stores in same browser's different tab . I faced the issue of session clash.

For example shop domains store1.myshopify.com and 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

i
Replies
Posts:
51
about 1 month ago
g
2
upvotes

I fixed this in my app Simple Purchase Orders recently.

When a user accesses the app from Shopify, a shop=store1.myshopify.com variable is sent in the get request, you need to check if that shop variable value is equal to the one stored in the session and if not re-authenticate the store.

Sundar Member
Posts:
3
about 1 month ago

@GhostApps Thank you for your valuable reply.

But in my case while click my menu it not conatin shop name as a parameter.

ie,

while open the app from installed app list page " shop1.myshopify.com/admin/apps  " it returns shopdomain as parameter in req.query

while i click my menu inside my embeeded app. req.query is empty. In such case how do i handle ? Pls explain. 

 

 

Posts:
51
16 days ago

You should probably set the shop in a cookie so you know who is accessing your app