-
Notifications
You must be signed in to change notification settings - Fork 980
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
How to debug bad upload tokens? #17182
Comments
Is it possible that you're using an API token from TestPyPI for PyPI or vice versa? If you can email the token to admin@pypi.org, we can further help with debugging. Don't post it publicly here or elsewhere. |
I have a theory about what happened. I've since generated new token and am more careful, and things work. I kinda wish there was more... just more visibility, like JWTs can be inspected with tools; maybe if the token appears truncated or is simply the wrong length, maybe that cloud be detected? |
It's possible! Hard to say without being able to see the token, however.
We're actually getting a lot of visibility here: it's telling us that the signature that is included inside the token is invalid. This could be from a number of things: missing or malformed characters, or a missused token. Unfortunately the tokens don't have a fixed size so simply checking the length is not possible. |
On top of what @di said: PyPI's API tokens are Macaroons, so you can parse them locally and extract their "caveats" (roughly analogous to JWT claims). I don't know of a super nice one-off tool that'll do this for you, though, since each Macaroon implementation chooses its own caveat layout (e.g. PyPI uses a packed encoding, but others might use JSON or CBOR or something else). |
This should be possible with https://pypi.org/project/pypitoken/ I think? |
Ah yep, forgot about that! |
When I
twine upload --verbose dist/*
, all I see is:Now I think I used this very token some time before and it works, but ofc., how can I be sure now?
The text was updated successfully, but these errors were encountered: