Shopify / themekit

Shopify theme development command line tool.
https://shopify.dev/tools/theme-kit
MIT License
1.19k stars 374 forks source link

Theme kit access app - Invalid API key or access token #954

Closed hugos closed 2 years ago

hugos commented 3 years ago

Describe the bug When using the new theme kit access app it always gives me this error: [API] Invalid API key or access token (unrecognized login or wrong password)

To Reproduce Steps to reproduce the behavior:

  1. run command 'theme get --password=[themeki tapp generated password] --store=store.myshopify.com'

Environment (please complete the following information):

Additional context Of all the times that I've tried using it it has only worked once. This is also happening to a lot of my colleagues.

denisinla commented 3 years ago

@hugos Your current command does not work since it contains unknown flag --name. If you're trying to create a new theme the proper command is theme new --password=[your-password] --store="[your-store.myshopify.com]" --name=[theme name]

hugos commented 3 years ago

@denisinla My bad that's just a typo on I don't actually write it like that lol. I spoke to Shopify, this is known issue there they are trying to fix it.

robertjmcinnis commented 3 years ago

I have what seems to be the similar issue.

Theme Kit was working fine on our development store. Then, I started getting this error whenever I tried to run any theme commands, for example:

Steps:

hugos commented 2 years ago

It's unbelievable that this is still happening.

fibonacid commented 2 years ago

I've found that you can bypass this problem by creating a custom app and configure the Admin API permission to read_themes,write_themes.

Anyone who is experiencing issues using the Theme Kit Access app can simply add this section into their README.md

### Bypassing \[API\] Invalid API key or access token

Sometimes the passwords generated with the Theme Kit Access app don't work. When that happens, it's pretty simple to create an access role manually:

- Log into your store dashboard 
- Click on _Apps_
- Click on _Develop apps_
- Click on _Create an app_
- Give it a name and click on _Create app_
- Click on _Configure Admin API scopes_
- Find the _Themes_ section inside _Admin API access scopes_ and select the following: `write_themes`, `edit_themes`.
- Click on _Save_
- Navigate to the _API credentials_ tab and click on _Install app_
- Install the app, then create an Admin API access token.
- Reveal access token and use it as themekit password
hugos commented 2 years ago

That's the "old way" and frankly, the one that works flawlessly all the time.

Shopify came with the theme kit access app so devs would stop using the private apps way. So yeah, your solution is essentially what every dev has been doing since the beginning, unfortunately.

fibonacid commented 2 years ago

Yeah, alternatively you can include source code in the repo and use the Github integration. There are a few options for this, but currently the best one i tried is using git subtrees.

  1. Create repo for source code
  2. Create repo for compiled code
  3. Connect a branch of the compiled repo to a Shopify Theme
  4. Build code from src to dist (include dist in version control)
  5. Push contents of dist on the source repo to the root of the compiled repo with:
    git subtree push --prefix dist compiled-repo-url $(git branch --show-current)
  6. Pull contents of compiled repo into dist with:
    git subtree pull --prefix dist compiled-repo-url $(git branch --show-current) --squash

You can abstract the process of keeping the dist folder always in sync with the subtree by using git hooks:

flowchart TD
    subgraph pre_commit_hook[pre-commit]
        stash_unchanged[git stash -q --keep-index]-->build_theme
        build_theme[yarn build]-->stage_changed[git add -u]
        stage_changed-->apply_stashed_changes=[git stash pop -q]
    end
    subgraph pre_push_hook[pre-push]
        pull_subtree[yarn subtree:pull]
    end
    subgraph post_push_hook[post-push]
        push_subtree[yarn subtree:push]
    end
    pre_commit_hook-->git_commit[git commit]
    git_commit-->pre_push_hook
    pre_push_hook-->git_push[git push]
    git_push-->post_push_hook
chippleh1392 commented 2 years ago

I had this issue with Theme Kit Access and was able to fix it by updating Theme Kit to the latest version.

colinwolf911 commented 2 years ago

[API] Invalid API key or access token (unrecognized login or wrong password) :(

laimoh commented 2 years ago

I'm on the latest version and still having this error....

hugos commented 2 years ago

It's still happening to me to this day as well. I just use the private apps method. I'll be closing this for now as this as been happening for too long and a solution does not seem to be coming any time soon.

leobaixinxin commented 1 year ago

I have what seems to be the similar issue.

Theme Kit was working fine on our development store. Then, I started getting this error whenever I tried to run any theme commands, for example:

Steps:

  • Using Theme Kit 1.3
  • OS: Mac os big sur
  • Run any themekit commant (eg/ theme watch)
  • After about a minute an error would appear: request failed after 5 retries with error: Get https://theme-kit-access.shopifyapps.com/cli/meta.json: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
  • Follow the JSON in the error message, https://theme-kit-access.shopifyapps.com/cli/meta.json. The JSON reads like this: {“errors":"[API] Invalid API key or access token (unrecognized login or wrong password)"
  • I’ve tried several things to remedy but all unsuccessful - Updating Theme kit, Homebrew, switching between Theme Kit Access App / Private App, Updating OS, different shopify stores.
  • The only thing that fixed it was switching to a different internet connection. After switching to a different IP theme kit works like normal.

it works, thanks a lot

PaulAShortt commented 2 weeks ago

Hi everyone,

I just wanted to add that I came across another instance of this issue: https://shopify.zendesk.com/agent/tickets/51939910

Store: https://app.shopify.com/services/internal/shops/59198537794

In this instance, the issue was caused by the merchant plugging in the store's BrandedDomain instead of the Permanent Domain