Hi Shopify team/community,
I’m using the new <shopify-account> component in a Liquid theme.
I configured the component with a custom sign-in-url that includes a return_to parameter:
<shopify-account
menu=“customer-account-main-menu”
sign-in-url=“/customer_authentication/login?return_to=%2Fpages%2Fafter-login”
For regular customer authentication flows, /customer_authentication/login?return_to=... works as documented here:
However, when the customer signs in using “Sign in with Shop” from inside the <shopify-account> sheet, the browser does not redirect to the return_to URL after successful login. Instead, it returns to the storefront root with:
https://{shop}.myshopify.com/?shop_sign_in=true
From inspecting the rendered markup, the internal shop-login component appears to use a redirect-uri pointing to the storefront root:
<shop-login
slot=“shop-login”
flow-version=“account_menu”
presentation-mode=“button”
redirect-uri=“https://{shop}.myshopify.com”
storefront-domain=“https://{shop}.myshopify.com”
And the iframe authorize URL also includes:
redirect_uri=https%3A%2F%2F{shop}.myshopify.com
I understand that shop-login is rendered inside the <shopify-account> shadow DOM, so I don’t think we can safely customize that internal redirect-uri from the theme.
My questions are:
-
Is
sign-in-url="/customer_authentication/login?return_to=..."expected to control the post-login redirect for the “Sign in with Shop” option inside<shopify-account>? -
If not, is there any supported way to specify a target page after a successful “Sign in with Shop” login?
-
Is
/?shop_sign_in=truethe expected return URL for this flow, and should themes/apps handle this by detectingshop_sign_in=trueand redirecting after the customer session becomes available?
Our use case is that after a customer signs in, we need to send them to a specific storefront page, for example:
/pages/after-login
Any guidance on the supported approach would be appreciated.
Thanks!