question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to set up CLI - authorization error

See original GitHub issue

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. image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
AllTradeszcommented, Aug 24, 2021

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.yml file 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.

1reaction
Vellizcommented, Aug 16, 2021

Thanks for mentioning authorization via browser. That’s excactly what i do. 😅

I will replace the token with-from account settings. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

GitHub Error: Authentication Failed from the Command Line
Command line authentication requires a personal access token. Go to Settings: Then Developer Settings:.
Read more >
Azure CLI authorization failed when running locally
I keep getting an authorisation failed error (The client XXXX with object id XXXX does not have authorization to perform action 'Microsoft.
Read more >
Authorize Org failed in VS Code - Salesforce Stack Exchange
When i am trying to create a new project in VS Code, i am not able to authorize org. I am getting the...
Read more >
Unable to authorize org due to Salesforce CLI extension issue
Type Name of Org and Enter. A browser window should pop-up for user to sign in to desired org BUT this is not...
Read more >
Troubleshooting AWS CLI errors - AWS Command Line Interface
This error means that the operating system can't find the AWS CLI command. The installation might be incomplete or requires updating. Possible cause:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found