What's your biggest current challenge? Have your say in Community Polls along the right column.

Solved

Shopify CLI returns invalid_target when logging in

mellowdecor
Visitor
2 1 10

I'm trying to run any command to start interacting with my store (I'm a store owner) but every time Shopify CLI returns invalid_target. First, it redirects me to the browser where I log in to my store and see the message:

You've successfully logged into the Shopify CLI!
You can close this tab and return to your terminal.

 

But then I see the invalid_target in my terminal.

 

I can't find any solution to this that would help me. It drives me crazy. Please help me if you know what to do.

 

Screenshot 2022-12-10 at 18.12.40.png

 

Just some information:

I have shopify-cli 3.25.0. I use a mac M1. shopify-cli  is installed under /opt/homebrew/bin/shopify

Accepted Solution (1)

mellowdecor
Visitor
2 1 10

This is an accepted solution.

Freaking hell. I spent 1 day wondering what is going wrong. Shopify docs on this topic should be improved 100%. It is very very annoying right now.

 

Anyways I fixed it.

 

You have to log into your Shopify store (how you would usually log in to your admin interface) to see what's it called (just in your browser) and this would be the link you need to pass, not the production URL.

 

And the link you need shouldn't have any slugs like it says in the Shopify docs. No /admin should be added to your link.

 

This is how it should be:

 

shopify theme dev --store https://beststore-7389.myshopify.com

 

then you get prompted to the browser and next, in your terminal, you should see Logged in.

 

View solution in original post

Replies 8 (8)

mellowdecor
Visitor
2 1 10

This is an accepted solution.

Freaking hell. I spent 1 day wondering what is going wrong. Shopify docs on this topic should be improved 100%. It is very very annoying right now.

 

Anyways I fixed it.

 

You have to log into your Shopify store (how you would usually log in to your admin interface) to see what's it called (just in your browser) and this would be the link you need to pass, not the production URL.

 

And the link you need shouldn't have any slugs like it says in the Shopify docs. No /admin should be added to your link.

 

This is how it should be:

 

shopify theme dev --store https://beststore-7389.myshopify.com

 

then you get prompted to the browser and next, in your terminal, you should see Logged in.

 

kat_hello
Shopify Partner
1 0 0

Holy sh%#t. What a simple solution. Thanks so much for posting this - I still wasted a few hours but this saved me a lot of time.

Cammyxalot
Shopify Partner
1 0 0

The best solution and the only one who worked for me. this page need to be higher in the research results 

MirandaTorres
Shopify Partner
1 0 0

Ty so much! it took me like one hour, I was trying to figure it out

demetrius_codic
Shopify Partner
1 0 0

I had the same error. I am a collaborator to the store (in an agency)
Using the full admin url did not work for me I keep getting invalid_target even though I was logged in in the browser .
The solution in my case was to use ONLY the store id eg:
shopify theme dev --store lace-shop 
NOT
shopify theme dev --store https://lace-shop.myshopify.com

I also wasted an hour on this...

 

ASteve
Shopify Partner
2 0 1

shopify theme dev --store {store-name} - No url attached, simply the name of your store... Avoid all https:// and shopify.com

e.g shopify theme dev --store {Lace-Shop}

 

Then it will work perfectly

ASteve
Shopify Partner
2 0 1

shopify theme dev --store https://lace-shop.myshopify.com

 This will also work

 

lmd808
Visitor
1 0 0

Saved me so much time, thank you!