Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Unable to log into customer account when using shopify theme serve

Solved

Unable to log into customer account when using shopify theme serve

Allan-EP
Shopify Partner
32 0 67

Using the CLI command shopify theme serve I'm unable to log into a customer account to be able to preview/modify those templates. My guess is there's some kind of authentication/cookie issue since it's at http://127.0.0.1:9292/ but this is a significant road block for using the CLI for development. Has anyone run into this and found a fix?

Accepted Solution (1)
drakedev
Shopify Partner
696 150 240

This is an accepted solution.

Dev team just released Shopify CLI 2.3.0 that should solve the reported issue (#1480)

Follow this guide to upgrade your version.

If my answer was helpful click Like to say thanks
If the problem is solved remember to click Accept Solution
Shopify/Shopify Plus custom development: You can hire me for simple and/or complex tasks.

View solution in original post

Replies 32 (32)

drakedev
Shopify Partner
696 150 240

Hi @Allan-EP 

do you use a staff account or partner account access to the client store?

Did you try to logout

shopify logout

and login again?

shopify login

Any errors? Can you try  to login to the specific store?

shopify login [--store=STORE]
If my answer was helpful click Like to say thanks
If the problem is solved remember to click Accept Solution
Shopify/Shopify Plus custom development: You can hire me for simple and/or complex tasks.
Rebeccajk440
Visitor
1 0 0

Yes 

Allan-EP
Shopify Partner
32 0 67

@drakedev The CLI store login is working fine for syncing changes using my partner account. What I'm referring to is logging into a user's account area on the front at /account/login while using

 

shopify theme serve

To get around this, I ended up pushing to the theme after each change, but that's pretty annoying compared to live reload or themekit's watcher. 

 

brendamarienyc
Shopify Partner
6 1 6

I just encountered this issue as well. I cannot log in to the store as a customer with an account from http://127.0.0.1:9292 which is generated from Shopify CLI with the command "shopify theme serve".  I tried a few different stores and different browsers with the same problem. This means I can't work on any development for features related to the customer object which is a big blocker! Can anyone help?

brendamarienyc
Shopify Partner
6 1 6

I found a good enough work around for this. You can preview the development theme while you are working on it using the link provided in the terminal after you run "shopify theme serve" under the heading "Share this theme preview". It doesn't hot reload the code changes on save like the local url, but it will show the updates on page refresh.

pepibumur
Shopify Staff (Retired)
5 0 2

Hi!

I'm Pedro from Shopify,

First of all, apologies for the inconvenience caused by this. We were able to reproduce the issue and we are looking into it.
I'll get back to you with a solution so that you can iterate on your themes smoothly.

To learn more visit the Shopify Help Center or the Community Blog.

drakedev
Shopify Partner
696 150 240

This is an accepted solution.

Dev team just released Shopify CLI 2.3.0 that should solve the reported issue (#1480)

Follow this guide to upgrade your version.

If my answer was helpful click Like to say thanks
If the problem is solved remember to click Accept Solution
Shopify/Shopify Plus custom development: You can hire me for simple and/or complex tasks.
Allan-EP
Shopify Partner
32 0 67

Just updated and tested - works!

lyonsun
Tourist
4 0 6

Hi,

It seems the problem still exists if the "Enable Google reCAPTCHA on login, create account and password recovery pages" setting is on. When I disable that, it works well then.

hydrogen
Shopify Partner
2 0 0

This is the solution on May 17 2023 using Shopify CLI version:

shopify --version
@shopify/cli/3.44.1 darwin-arm64 node-v19.8.1
hydrogen
Shopify Partner
2 0 0

This is the solution on May 17 2023 using Shopify CLI version:

shopify --version                           
@shopify/cli/3.44.1 darwin-arm64 node-v19.8.1
zero_nelson
Shopify Partner
2 0 0

Thanks. One issue though: Ruby gems doesn't have any version after 2.19…

zero_nelson
Shopify Partner
2 0 0

Thanks. One issue though: Ruby gems doesn't have any version after 2.19, how can we upgrade with Ruby?

SingleMusic
Shopify Partner
11 0 1

This issue appears to be back. I cannot log in to a customer account locally.

 

  @Shopify/cli/3.21.0 darwin-arm64 node-v18.11.0

jclarkecomdept
Shopify Partner
2 0 3

Unfortunately, Shopify has removed the ability to turn captchas on/off in the Customer Accounts section of the store settings. This was the only existing workaround for this issue.

This needs more attention from the dev team.

Ogdila
Shopify Partner
30 0 17

I still have this issue. Would you please kindly tell me if you sorted this out? Thank you!!!

pepibumur
Shopify Staff (Retired)
5 0 2

Hi @Ogdila, and apologies for the inconvenience.
Would you mind sharing more details about the error you are encountering? Does the CLI throw any error that might shed some light to understand the underlying error better?

To learn more visit the Shopify Help Center or the Community Blog.

Ogdila
Shopify Partner
30 0 17

Thanks, @pepibumur.

I did not receive an error.

I set up the CLI on my theme and started the development by typing "Shopify.theme.serve", then I can start editing my theme with all the hot reload and other CLI features locally.

The CLI serves the theme on  http://127.0.0.1:9292/, and all is good. However, when I want to work on the customer account template files locally, I go to the "login" button and try to log in "as a customer." The page redirects to the reCAPTCHA page, and no matter how many times I submit the reCAPTCHA, it refreshes the same page.

So I disabled the reCAPTCHA in my store settings and tried again. With the reCAPTCHA disabled, the login page refreshes itself instead of logging me in as a customer, so I cannot edit the account template pages locally.

It might be because of the "HTTP" that is not secured or because it's running on localhost. That, I am not sure.

pepibumur
Shopify Staff (Retired)
5 0 2

Hi again,
Thanks for the detailed steps. May I ask what version of the CLI are you using? You can get it by running `shopify version`. In case you are not running the latest, 2.6.3, which was released yesterday, I'd recommend updating and trying again.

To learn more visit the Shopify Help Center or the Community Blog.

Ogdila
Shopify Partner
30 0 17

@pepibumur  I already tested  2.6.3 this morning, no change. I was thrilled when I saw three updates were pushed out the same night, and hoping that it may have this issue resolve, but it ain't. 

So what would be the root of my issue? Any idea?

pepibumur
Shopify Staff (Retired)
5 0 2

Unfortunately, I can't pinpoint what the issue might be yet. Could you run the CLI but prefixing the command with `DEBUG=1` to see if more log verbosity sheds more light?.

To learn more visit the Shopify Help Center or the Community Blog.

EbenHafkamp
Shopify Partner
15 1 5

Can confirm that logging in with reCAPTCHA it is still an issue on 2.6.5

Ogdila
Shopify Partner
30 0 17

@EbenHafkamp  I double that, again.

Paul_vd_Dool
Shopify Partner
112 6 99

I can concur this is still an issue for Shopify CLI version 2.7.4

 

When on localhost:9292 and you try to access the account area of your shop you're prompted to login. When logging in you get a reCaptcha on localhost:9292/challenge. After submitting the reCaptcha you're redirected to the actual store address my-shop-slug.myshopify.com/challenge and have to do it again.

 

You can work around it though by disabling Google reCaptcha for the account page.

1. Go to the Admin page for your (development) store

2. Go to Online Store > Preferences

3. Scroll down to the 'Spam protection' section

4. Uncheck checkbox for "Enable Google reCAPTCHA on login, create account and password recovery pages"

 

This is a suitable workaround for me as it's a development store.

Doppelganger - Managing duplicate user accounts

pinguluk
Tourist
8 0 3

vipul28
Shopify Partner
1 0 1

I am facing the same issue.
As soon as you complete captcha it redirects to the website with actual address instead of localhost which breaks the link and hot reload functionality. If anyone has a solution, please refer.
Shopify CLI version 3.44.1

Hugtrash
Shopify Partner
3 0 3

Same problem here on Shopify CLI Version 3.44.1.

I complete the captcha, after that i will be redirected to "liveurl/challenge" and get a 404.

zhicheng1
Shopify Partner
28 2 10

Same problem over here.

edwindonaldo
Shopify Partner
1 0 1

The same problem with Shopify CLI Version 3.49.3.

 

aaronwest18
Shopify Partner
1 0 1

CLI Version 3.60.1 and I am also getting the "Invalid or missing reCAPTCHA token" page when attempting to login from the local development login page: http://127.0.0.1:9292/account/login

 

@Shopify/cli/3.60.1 darwin-arm64 node-v22.2.0

Switchmode
Shopify Partner
4 1 1

Commenting to add to the collective discussion - a previous solution I had for reverse engineering the recaptcha token to submit forms with JS on published themes now also doesn't work.

So far a more sophisticated reverse engineering approach has been unsuccessful (getting invalid token errors). Is there a current + recommended solution for submitting login etc forms using JS? Shopify Buy uses the Storefront API and doesn't handle sessions.

Switchmode
Shopify Partner
4 1 1

Update on this - here's the solution - not sure what's kosher here so keeping it brief! Site key is in the html for loading the recaptcha. 

```
const token = await window.grecaptcha.enterprise.execute(RECAPTCHA_SITE_KEY, { action });
formParams['recaptcha-v3-token'] = token
```