Discourse_theme CLI for unsupported Discourse versions

AI-generated summary

David_Pešava encountered a 403 error while using the Discourse_theme CLI to watch a theme, despite having a valid admin API key. david suggested testing the API key via curl and reviewing the key’s configuration in the Discourse admin panel. David_Pešava confirmed the key worked via curl but noted it failed for colleagues as well, hinting at a possible version mismatch David_Pešava. david asked about the Discourse instance setup, prompting David_Pešava to suspect version incompatibility — he was using the latest CLI with an older Discourse server David_Pešava. david confirmed this: the CLI now uses header-based authentication, unsupported in older Discourse versions, and strongly advised upgrading Discourse for security and stability. As a workaround, David_Pešava could install an older CLI version with gem install discourse_theme -v "<0.3.0". David_Pešava confirmed the workaround resolved the issue David_Pešava.

Hi,

I’m getting Error 403 when trying to run watch for first time.
Console output:
discourse_theme watch .
» Using http://mywebsize.com/ from /Users/davidpesava/.discourse_theme
» Using api key from /Users/davidpesava/.discourse_theme
✘ Error 403 for https://mywebsite.com/about.json

Generated API key is for admin user, I tried --reset multipe times

Multiple people are using the CLI on a day-to-day basis, so I think this is unlikely to be a CLI bug. Can you try using the same API key from curl or something similar?

There are some examples on how to do that near the top of https://docs.discourse.org/

Also, can you show a screenshot of the API key configuration in the Discourse admin panel? (make sure to block out the actual key)

thanks for answer.

with curl it is working ok, I get that json
I tried colleagues APi that worked last time but not at this time

How is your discourse instance set up? Did you follow the standard install guide? Is it in a subfolder? Do you have any reverse proxies enabled?

Just trie few things now, is it possible that problem is in versions? I have lates version of theme CLI but on server is little bit older

can I use older version of theme CLI?

Ah, that would explain it. The theme CLI was recently migrated to use header-based API authentication. That is supported in all current versions of Discourse, including the stable branch.

If you are using an older version of Discourse, I strongly recommend you upgrade ASAP, so that you’re not missing any critical security/bug fixes.

You can do something like

gem install discourse_theme -v "<0.3.0"

thanks for supprot, it works now