How to redirect after successful Sign in with Shop inside?

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:

  1. 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>?

  2. If not, is there any supported way to specify a target page after a successful “Sign in with Shop” login?

  3. Is /?shop_sign_in=true the expected return URL for this flow, and should themes/apps handle this by detecting shop_sign_in=true and 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!

Hi @gina_sato Welcome To Shopify Community So with the <shopify-account> component, when customers sign in via Sign in with Shop, the return_to parameter is currently ignored, and they remain on the current page after logging in — so your observation is correct, sign-in-url’s return_to is scoped to the standard /customer_authentication/login flow only, not the embedded Shop sign-in sheet. That’s not a misconfiguration on your end, it’s a real gap in how the two flows are wired.

To your second question, there’s no currently supported way to pass a target page into the Shop sign-in flow specifically, since <shop-login> is rendered inside <shopify-account>'s shadow DOM exactly as you found, and its redirect-uri is fixed to the storefront root rather than being exposed as a configurable attribute from the parent component.

On your third question, ?shop_sign_in=true does appear to function as the de facto signal that a Shop-based session just completed, so the practical (if unofficial) approach right now is detecting that query parameter on page load and handling the redirect yourself with a small script — checking for shop_sign_in=true in the URL, then reading customer (or checking window.Shopify.customer / your theme’s customer object) to confirm the session is live before redirecting to /pages/after-login. It’s a workaround rather than a documented API, so it may need revisiting if Shopify changes this behavior in a future update.

Hope this helps clarify things — feel free to mark as solution and also like if it answers your question!

Hi @Mustafa_Ali
Thanks for confirming that and for explaining how the two flows are currently wired. That’s very helpful.

I did try the workaround of detecting shop_sign_in=true after the Shop sign-in flow completes and then redirecting the customer from there. It works technically, but from a UX perspective it doesn’t feel ideal, because the customer first lands back on the storefront root/current page and then gets redirected again afterward.

So I just wanted to confirm whether there is any supported way to control the destination directly in the Sign in with Shop flow, but it sounds like that is not currently exposed.

Thanks again for clarifying!

Hi @gina_sato So This Is Confirmed — there’s no supported way to set the destination directly in the Sign in with Shop flow right now, so the double-hop you’re seeing (land on root, then get redirected) is the expected behavior with the current workaround, not something you’re doing wrong.

If the flash of the root page is the main UX concern, one thing that can soften it slightly is redirecting as early as possible in the page lifecycle (before first paint, e.g. in a blocking script in the <head>) rather than waiting for full page load, so the visual “landing” on root is barely visible before the second redirect fires. It won’t eliminate the extra hop, but it can make it feel closer to instant instead of a visible flicker.

Beyond that, this is worth flagging in Shopify’s Feedback area as a specific ask (expose a configurable redirect target for the Shop sign-in flow), since right now it’s genuinely a platform limitation rather than something themes can fully solve on their own. Hope this helps clarify things — feel free to mark as solution and also like if it answers your question!