Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI is unable to authenticate when using apiUrl #103

Open
wfjsw opened this issue Jul 26, 2024 · 7 comments
Open

CLI is unable to authenticate when using apiUrl #103

wfjsw opened this issue Jul 26, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@wfjsw
Copy link

wfjsw commented Jul 26, 2024

Starting from some recent CLI version, using npx @tolgee/cli pull was not sufficient to authenticate to the self-hosted server when apiUrl is present in .tolgeerc.yaml.

...
projectId: 20
apiUrl: "https://server"
format: JSON_TOLGEE
...
> npx @tolgee/cli pull
Need to install the following packages:
@tolgee/[email protected]
Ok to proceed? (y) y

🔴 No API key has been provided. You must either provide one via --api-key, or login via `tolgee login`.

Instead, I must do npx @tolgee/cli --api-url https://server pull

> npx @tolgee/cli --api-url https://server pull
🐭✅     Fetching strings from Tolgee...
🐭✅     Extracting strings...
✅ Done!
@stepan662
Copy link
Contributor

stepan662 commented Aug 21, 2024

Hey, sorry for late reaction. And you are using env variable, or login command? I've tested the apiUrl in the config and I haven't found any issues with that.

@stepan662 stepan662 self-assigned this Aug 21, 2024
@wfjsw
Copy link
Author

wfjsw commented Aug 21, 2024

I did logged in with command and it requires apiurl arg at that time. Let me try once again later...

@wfjsw
Copy link
Author

wfjsw commented Aug 23, 2024

Hmm tried once again with npx @tolgee/cli login without --api-url and now it works. Dunno what's the deal with the undefined thing.

> npx @tolgee/cli login xxxxx
 ✅ Logged in as *** on undefined. Welcome back!
> npx @tolgee/cli pull
 🐭✅     Fetching strings from Tolgee...
 🐭✅     Extracting strings...
 ✅ Done!

@wfjsw
Copy link
Author

wfjsw commented Aug 23, 2024

Looking at the authentcation file it is stored in a separated entry than that stored with --api-url. Is this expected?

@stepan662
Copy link
Contributor

I'll need to check the login functionality, it seems like it's not very intuitive.

@stepan662 stepan662 added the enhancement New feature or request label Sep 17, 2024
@Pezhvak
Copy link

Pezhvak commented Dec 6, 2024

I don't know what the issue is, after logging in with self-hosted instance (using --api-url) it says:

✅ Logged in as Pezhvak on XXXXXXX for project XXXXX (#3). Welcome back!

But then when i try to do tolgee pull it says:

🔴 No API key has been provided. You must either provide one via --api-key, or login via `tolgee login`.

I even created tolgee.config.js and added apiUrl and projectId to it, but nothing helped, on my other project randomly it works, something is not right, i guess it have something to do with providing custom api-url for self-hosted instance.

@Pezhvak
Copy link

Pezhvak commented Dec 6, 2024

I think i found the issue, if you provide --api-url in tolgee login, it will save the credentials with it, but tolgee config file does not recognize the provided tolgeeUrl from config file, it looks into undefiened property in the authentication.json. it's weired, when i try to login without the --api-url it reads the server from config file and works, but it saves the credentials in the same property as mentioned which is undefined not in the right property which seems to be tolge instance server url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants