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 registry dependencies using API token #2538

Open
2 of 3 tasks
danieleades opened this issue Jun 10, 2020 · 6 comments
Open
2 of 3 tasks

Private registry dependencies using API token #2538

danieleades opened this issue Jun 10, 2020 · 6 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@danieleades
Copy link
Contributor

  • 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).
  • ubuntu 18.04
  • poetry 1.0.5

Issue

Apologies for the brevity of this description, i'm not in front of my machine right now. There may be a very simple answer to this question.

Are private pypi registries accessible using the API token, rather than username/password? I see that API token support for the public pypi registry was added in #1275, was this intended to also provide support for non-public registries?

  • we have an Artifactory-hosted pypi registry
  • we can use poetry with this registry using username and password authentication
  • we cannot use API token authentication with this registry
  • we have security concerns with using username/password authentication
  • other tools (such as twine) are able to access this registry using the API token, rather than username/password

I guess i'm asking if some part of the API token authentication implementation is hardcoded to the public pypi registry?

If it is intended that this should work, what diagnostic information can I provide, or debugging steps can I follow?

(note that i'm lagging a couple of releases on the poetry version. Please let me know if there's any changes that could affect this that are undocumented in the changelog)

@danieleades danieleades added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 10, 2020
@Persedes
Copy link

we have a similar setup and poetry (>=1) works fine with a PAT.
You can use the following command:

poetry config http-basic.foo $PAT "" (where pat goes in place of the user name)

https://python-poetry.org/docs/repositories/

@danieleades
Copy link
Contributor Author

@Persedes if that works that is a massive help!

I'm going to tentatively say that this is still a bug. there's a documented solution using the api token that doesn't work-

poetry config pypi-token.$REPO $TOKEN

and an undocumented solution which allegedly does work

poetry config http-basic.$REPO $TOKEN ""

@jdeyton
Copy link

jdeyton commented Jul 26, 2020

@danieleades I'm of the opinion the documentation is a little unclear. However it seems to work for multiple users:

There are steps provided here in #910, specifically #910 (comment)

For what it's worth, I was able to get a poetry to publish to a pywharf container backed by the local filesystem using this approach, with the exception that I provide the repo name as the username, e.g., with the repo "mypypi" and secret "foo":

user@host > poetry config repositories.mypypi http://localhost:8888/simple/                                                                                                                                                          
user@host > poetry config http-basic.mypypi mypypi foo
user@host > poetry publish -r mypypi

@matt-long-92
Copy link

I have encountered this issue also. Is anybody planning to work on resolving this?

@CarloDePieri
Copy link

I could not make poetry (v1.1.14) authenticate with private repo api token by using the cli either.

My current workaround is:

  • adding the repo with poetry config repositories.myrepo https://youraddress
  • manually edit the poetry global auth file (mine is at ~/.config/pypoetry/auth.toml) by adding this section:
[http-basic]

# possibly other repos are here

[http-basic.myrepo]
username = "__token__"  # literally this, it's not a placeholder
password = "mysecrettoken"  # the api token goes here

After that poetry can authenticate successfully and without further user interaction.

I could not replicate this working config by any combination of http-basic / pypi-token.

@charterchap
Copy link

For jfrog artifiactory specifically try generating a token for your user

[http-basic]
[http-basic.ag-dev]
username = "USERNAME"
password = "YOUR_TOKEN"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

6 participants