Issue: Shopify CLI shows “You’ve successfully logged into the Shopify CLI” in the browser but returns invalid_target in the terminal when running shopify theme dev. OP on macOS (M1) with shopify-cli 3.25.0.
Cause: Passing the wrong value to --store. Using the storefront/production domain or an admin URL (with slugs like /admin) causes invalid_target. The CLI expects the myshopify.com subdomain or the store ID (name).
Store ID (name) only: shopify theme dev --store lace-shop
Non-working inputs:
Admin URLs or any URL with /admin.
For some collaborators, even the myshopify.com URL failed; only the store name worked.
Outcome: Multiple confirmations that using either the myshopify.com domain (no slugs) or the store name resolves invalid_target. No further open questions; effectively resolved.
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.
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.
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