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

Private repository with basic auth #4623

Closed
3 tasks done
adrpp opened this issue Oct 11, 2021 · 5 comments
Closed
3 tasks done

Private repository with basic auth #4623

adrpp opened this issue Oct 11, 2021 · 5 comments
Labels
kind/bug Something isn't working as expected status/needs-reproduction Issue needs a minimal reproduction to be confirmed

Comments

@adrpp
Copy link

adrpp commented Oct 11, 2021

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

Hello,

first of all, thanks for this great packaging tool :)
I have some questions (and a feeling a part of it might be a bug ?) about using poetry with private repository with basic auth.

My setup is:

  • private repo on nexus, mirrors public packages
  • all requests are made to private repository and if it's a company made package, it's provided by private repository, otherwise it will be provided from 'mirrored pool'
  • in my application, as provided in gist link, there is one dependency called "my.dot.notated.dependency" which is provided by private repository

Would be happy with having uri inside of pyproject.toml, but the credentials set via env vars or cli (as a part of a pipeline job).
Regarding cli, poetry config http-basic.nexus username password should do the trick, however, it doesn't.

Only way it works is to put the creds into repo uri as part of [[tool.poetry.source]].
poetry config http-basic.nexus username password will be somehow persisted somewhere, as poetry config --list shows related section, but won't get used by poetry / pip while accessing the repository (?)

Setting poetry config http-basic.nexus username password but ommiting credentials in the [[tool.poetry.source]] section leads to 401 / Unauthorized responses. Looks like resolving dependencies against nexus pypi repository requires repo url contains credentials.

Update:
similar behavior mentioned here: #4389
However, setting POETRY_HTTP_BASIC_NEXUS_USERNAME & POETRY_HTTP_BASIC_NEXUS_PASSWORD ("NEXUS" due to my setting of repo name, see gist file) doesn't auth the request like mentioned in the issue.

Thanks for any help in advice.
Adrian

@adrpp adrpp added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 11, 2021
@AnotherStranger
Copy link

AnotherStranger commented Oct 26, 2021

I got the same error but only after upgrading to 1.1.9+. Older versions work well for me.
Did something change regarding the private repos?

We could reproduce the problem on different machines.

  1. Install any poetry version <=1.1.8
  2. Private repos should work without any problems
  3. Update poetry
  4. Run poetry update
  5. You'll get an 401 error
  6. Revert to an older poetry version
  7. poetry update works again.

Maybe this information helps...

@JamieMcKernanKaizen
Copy link

JamieMcKernanKaizen commented Nov 16, 2021

I am also having this issue. I am using:
poetry 1.1.11
Ubuntu 20.04.3 LTS

I've observed that when running poetry config http-basic.repo_name username password the password does get added to the built in Ubuntu password store (called Passwords and Keys). But it seems poetry can't access this and gives the 401 instead.

The current workaround I've found is to disable the keyring library, and edit the auth.toml myself with the username and password.

I can confirm using poetry 1.1.8 fixes the issue.

@usmcamp0811
Copy link

I can report I've tried almost every version from 1.0 to the current beta and I still get the 401. I am using a Ubuntu based Python Docker image.

@neersighted neersighted added status/needs-reproduction Issue needs a minimal reproduction to be confirmed and removed status/triage This issue needs to be triaged labels Oct 4, 2022
@neersighted
Copy link
Member

This should be working on Poetry 1.2, and does not reproduce for me on Ubuntu 20.04. If you are having issues with correctly configured credentials not being passed, please open a new issue with a detailed reproduction.

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2022
Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/needs-reproduction Issue needs a minimal reproduction to be confirmed
Projects
None yet
Development

No branches or pull requests

5 participants