crowdin-cli: Unable to set up CLI - authorization error
Help would be massively appreciated!!
Describe the bug
Trying to set up CLI, and just can’t get it to work. Keep getting
$ crowdin list -v project ❌ Fetching project info ❌ Failed to collect project info. Please contact our support team for help ❌ Couldn't authorize. Check your 'api_token'.
Brand new api_token generated and used.
This command works fine after editing the stub crowdin.yml generated by “crowdin init”
$ crowdin lint Your configuration file looks good
To Reproduce
- create stub crowdin.yml using
crowdin init - edit crowdin.yml to add project, so
#
# Your Crowdin credentials
#
"project_id" : "460284"
"api_token" : "my token copied from crowdin web UI (not a CrowdIn enterprise account/project)"
"base_path" : "."
"base_url" : "https://api.crowdin.com"
#
# Choose file structure in Crowdin
# e.g. true or false
#
"preserve_hierarchy": true
#
# Files configuration
#
files: [
{
"source": "src/locales/en/*.json",
"translation": "src/locales/%two_letters_code%/%original_file_name%"
}
]
Environment:
$ java --version openjdk 11.0.12 2021-07-20 OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2deb10u1) OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2deb10u1, mixed mode, sharing) $ crowdin --version 3.6.4
Additional context
It could be my CrowdIn project is munged somehow. In efforts to troubleshoot, I deleted and created new api_tokens. I just noticed in the web UI that at some point a successful API connection was made, as shown below. I believe this was before I deleted and recreated the token. Obviously though I had never seen success when on the CLI, else I wouldn’t have tried the recreation. I am left to speculate that somehow the project is rejecting new auth tokens? Weird.

About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (8 by maintainers)
All right. Finally freaking resolved. As expected, something incredibly dumb at fault.
Per the security suggestion in the docs, early on I had placed my api_token in a
.crowdin.ymlfile in my home directory. Eventually I forgot about it. Well, that bugger silently overrides anything placed in that property in the normal yml file!I suppose it would make sense for the code to spit out a warning when this is encountered, so consider that a tiny feature request. 🙂
I discovered this cause by actually stepping through the code in the JDK’s text-based debugger
jdb, my first time using this. Works pretty well for something so lightweight, can set breakpoints, switch stack frames, inspect objects, remote debug. So at least I got that knowledge out of this ordeal, haha.Thanks for mentioning authorization via browser. That’s excactly what i do. 😅
I will replace the token with-from account settings. 👍
@Velliz if a token is generated in account settings, it has no expiration.
But in the case of authorization via browser using the
crowdin initcommand, a token has an expiration - 1 month.@AllTradesz could you please check on another computer?
Also, you could try to use Postman on the current computer and make some API calls to Crowdin using your token. Just to be sure
If you are using some proxy on your computer, CLI requires some additional configuration - Using Crowdin CLI with Proxy Server
@AllTradesz ok, I can try to run CLI with your token. Please send it using this form - https://crowdin.com/contacts. You can mention this issue and our support team will pass this token to me.