Skip to content

When you create an API token, provide instructions for storing it in a more secure way than "plain text file on disk" #17948

Open
@alexwlchan

Description

@alexwlchan

What's the problem this feature will solve?
When you create an API token, you get the following instructions:

Using this token

To use this API token:

  • Set your username to __token__
  • Set your password to the token value, including the pypi- prefix

For example, if you are using Twine to upload your projects to PyPI, set up your $HOME/.pypirc file like this:

[pypi]
  username = __token__
  password = pypi-AgEIc…

For further instructions on how to use this token, visit the PyPI help page.

Saving credentials to a plaintext file isn't particularly secure, and Twine has supports saving it in your keychain with keyring for years.

I think it would be good to have a brief mention of the keyring support here. It's a few more steps and shouldn't be the only option listed, but not mentioning it at all makes it easy for people to not realise that a more secure approach exists.

Describe the solution you'd like
Add an additional paragraph like:

If you are using Twine and have keyring installed, you can save your API token securely in your system keychain:

keyring set https://upload.pypi.org/legacy/ __token__

Additional context

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions