New customer account: login issue on return to storefront

Hi, I’m having an issue with the customer account login that started yesterday. Here’s what’s happening:

I visit the store and log in using the PIN method (new customer account experience). After logging in, I’m correctly redirected to the customer account - specifically to the Orders page. Then, when I click on the store logo to go back to the storefront, I get the error shown in the attached screenshot.

It looks like some kind of customer authentication issue - even though I’m already logged in?

To return to the storefront, I have to go back to the Orders page and click the logo again. The second time it works, but there’s something strange: in my Liquid templates, I use {% if customer %} to show customer-only elements, and they don’t appear - even though I’m clearly logged in.

This is a pretty big issue for us - I’d really appreciate your help or insights if anyone else is seeing this too.

Here is a fragment of my URL:
/customer_authentication/callback?source=core&code=

One extra detail: I’m currently running an A/B test with Intelligems, comparing two versions of the navigation menu. Could this test be interfering with customer authentication?

Thanks in advance!

EDIT:
I tried to use <a href="{{ routes.storefront_login_url }}" class="button grey">Sign In</a> on the preview theme but it doesn’t work either. This time I see this:

Hey @lynthius :waving_hand: - the new customer account experience doesn’t currently support Liquid customizations (there’s a bit more info here), so I suspect this could be what’s causing the issues that are popping up here.

The new customer accounts operate separately from the rest of the storefront and customization for them is intended to be routed through their own surface:

Just to clarify, are you using that authentication callback URL within Liquid? The new customer accounts feature, uses a different set up than the old model via the GraphQL API, so I wonder if that’s what is causing the mismatch there: Customer Account API reference

Hope to hear from you soon, happy to help with this :slight_smile:

Hi @Alan_G, thanks for your help. I’ll let you know this week, I didn’t have any time to look into it more closely last week.

1 Like

I’ve investigated the issue a bit more and here’s a detailed explanation of what’s happening. It’s a simple situation.

I have a login icon in the navigation that uses this Liquid logic:

{% if customer %}
  {{ routes.account_url }}
{% else %}
  {{ routes.account_login_url }}
{% endif %}

When I visit the storefront and click that link, I’m redirected to the PIN login page (as expected). I enter the code, and I’m taken to the Orders view.

Now, from the Orders page, when I click on the store logo to return to the storefront, I get the error I mentioned earlier.

The Orders page itself hasn’t been customized. When I hover over the store logo from the Orders page, I can see that the link contains something like:

https://store/?accountnumber=6666666666666&country=PL

Clicking that link results in the error.

Strangely, if I go back in the browser, and then click the store logo again from the Orders page, it does take me to the storefront - but it still doesn’t recognize that I’m fully logged in. For example, {% if customer %} doesn’t return true even though I should be authenticated.

At that point, the URL looks like:

https://store/pl/?accountnumber=6666666666666&country=PL

Any ideas what might be causing this behavior? Is there a way to ensure proper recognition of the customer state in this flow?

Thanks again!

Hi @lynthius, thanks for explanation here, really appreciated!

From what I can tell, the behaviour you’re experiencing might be related to how the new customer account experience handles authentication separately from the traditional customer account set up with Liquid. My understanding is that the new system doesn’t automatically sync with the Liquid {% if customer %} context since login happens on another domain, which might explain why your customer state isn’t being recognized even after a successful login.

When you click the store logo from the Orders page, those URL parameters (accountnumber and country) are usually part of an authentication handoff. It could be that these are failing, and is why the second click works but still doesn’t set the customer state in Liquid.

Would you be able to share when you migrated to new customer accounts and whether this was working before (I’m guessing so, but just wanted to check!). Also, if you’re able to share the exact error message you’re seeing, and try temporarily disabling your Intelligems A/B test to rule out any interference with the authentication flow and let me know those two results/the error message, that would be super helpful!

If you need the customer state recognized in your Liquid templates, you might need to consider reverting to classic customer accounts temporarily, or implementing authentication checks using the Customer Account API directly so we can dig into this (if you haven’t done this already)

Let me know what you find and I’d be happy to look into this further - if you’d prefer sharing this info over DM, just let me know too and I can set one up so we can chat there :slight_smile:

Heyy,
I want to pass a static email into the email field of Shopify’s new customer account system because I’m using a custom form field to collect the user’s email, and I’m logging them into Shopify using that email.

Hey @Pankaj_P, thanks for reaching out.

With the new customer accounts feature, you can’t prefill the Shopify‑hosted login email field or enable a "log in by email.” feature that bypasses the Shopify-hosted login page like you can with “classic” customer accounts on the Liquid-based storefront.

If you’re a headless/Hydrogen shop, you can use the Customer Account API to orchestrate login/authorize/isLoggedIn and then just show a quick confirmation step in your UI before redirecting, though.

For example, users could still enter their email on the Shopify page (docs: Using the Customer Account API with Hydrogen) and then be directed to login via the Customer Account API.

If you need a true SSO or a prefilled-style experience, Multipass is available on Shopify Plus and works with classic customer accounts (docs: Multipass). If you can share whether you’re on Hydrogen or a Liquid theme and whether you’re on Plus, I can point you to the exact implementation steps. Hope this helps, let me know if I can help out further!

With the new customer account, any chance we can have a seamless login user experience like Multipass? Currently we have our self-hosted website with its own authentication process, and our customer use multipass url to directly to our liquid Shopify store. However, it seems that the new customer accounts feature cannot support that. Customer will have to experience more redirect or manual input to login, which is bad for UI. And as far as I know the classic customer accounts will be deprecated sooner or later by your company. Do we have any better solution? or Shopify is going to take a user-friendly feature from merchants again and just make everyone experience worse?

Hey @Tom_Chan :waving_hand: thanks for sharing your concerns, I definitely understand where you’re coming from here. Multipass does provide a really smooth experience for exactly your use case where you have an external site with its own authentication.

I actually have some good news, with new customer accounts, there’s now support for connecting your own identity provider (3P authentication) which might work for your use case. If your self-hosted site uses an OAuth 2.0/OpenID Connect-compliant identity provider (like Auth0, Okta, Amazon Cognito, etc.), you can configure that same IdP to handle authentication for your Shopify store. This means customers would authenticate through your IdP instead of Shopify’s login page, giving you a more consistent login experience across your properties.

It’s not quite the same as Multipass’s zero-redirect token flow, customers still go through your IdP’s login UI but if your IdP supports session persistence, they could potentially get an SSO-like experience where they don’t have to re-enter credentials. This feature is available for Plus merchants. You can check out the requirements here: Requirements for connecting your own identity provider to customer accounts.

Let me know if you have questions about whether your current auth setup would be compatible, or if I can help with anything else!

Hi @Alan_G — due to our workflow, we need to build our own IdP.

I’ve tested the connection via the Shopify Admin and the authentication works as expected. However, after login, the user is always redirected to the default orders page:

https://shopify.com/*****/account/orders

Is there any way to configure the post-login landing destination?

Previously, when using Multipass, we were able to pass a return_to parameter to log customers in and redirect them to a specific page immediately. Is there an equivalent mechanism available when using a custom IdP?

@Tom_Chan, you should be able to use the /customer_authentication/login path with a return_to parameter to redirect customers to a specific page after signing in. This should work with your 3P IdP setup as well. The key is that the return_to value needs to be a relative URL (not a full URL).

So from your self-hosted site, instead of just sending users to the login page, you’d construct the URL like this:

https://your-store.myshopify.com/customer_authentication/login?return_to=%2Fcollections%2Fyour-collection

Or if you’re using Liquid anywhere on the Shopify side:

<a href="/customer_authentication/login?return_to={{ "/pages/your-page" | url_encode }}">Sign in</a>

After successful authentication through your IdP, the customer should land on whatever page you specified in return_to instead of the default orders page.

You can check out more details in our docs here: Redirect customers after signing in

Let me know if that works for you, or if you run into any issues!

Hey @Tom_Chan - just checking in :waving_hand: - let me know if the above helped, cheers!