I’ve just been building my first embedded app for Shopify. The installation process is a little different than the one used by non-embedded apps. For a few days it’s been bugging me that the app kept returning to the store admin dashboard after installation and when the session expired. It was clearly installing correctly and logging me in because the next click on the same link worked.
Well I finally sort it out today. It turns out that I had accidentally set
shopOrigin: 'https://store-url.myshopify.com/' instead of
shopOrigin: 'https://store-url.myshopify.com'. That trailing
/ was the cause of my grief. It resulted in Shopify redirecting to https://store-url.myshopify.com//admin/apps/some-id when it tried to put the app back inside an iframe. The double
// in that URL caused Shopify to redirect to the store login page which sent the user on to the store admin dashboard because they’re already logged in.
Days of pain all for one little