PyPI API Upload Token Isn't Working

I have a package that I would like to upload with a token from my PyPI account, but when I do it returns this:

C:/desktop/Module>>> twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: __token__
Enter your password: 
WARNING  Your password contains control characters. Did you enter it correctly?
WARNING  See https://twine.readthedocs.io/#entering-credentials for more information.
Uploading Module-2.1.1-py3-none-any.whl
100% ---------------------------------------- 6.4/6.4 kB • 00:01 • ?
WARNING  Error during upload. Retry with the --verbose option for more details.
ERROR    HTTPError: 403 Forbidden from https://upload.pypi.org/legacy/
         Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more
         information.

When I created the token I copied and pasted it in so I know that the problem is not that I have typed it in incorrectly. Does anyone know why this is?

Does the password really contain control characters?

Did you inadvertently copy too much, such as a preceding or trailing newline or tab character? Both are considered control characters.

Did you open the suggested URL for more information? There, you’ll find:

If you’re using Windows and trying to paste your username, password, or token in the Command Prompt or PowerShell, Ctrl-V and Shift+Insert won’t work. Instead, you can use “Edit > Paste” from the window menu, or enable “Use Ctrl+Shift+C/V as Copy/Paste” in “Properties”. This is a known issue with Python’s getpass module.

Thanks for that, that is will be why it is not working. However my Command Prompt does not have any menus up the top. Will there be another way to do this?

Hmm, I hadn’t noticed, but in the latest version of Windows 11, the CMD window that those instructions refer to is now gone, and in its place the Windows Terminal app (now called just Terminal) opens instead no matter how you launch the Command Prompt.

Is that what you are getting?

You can get the context menu of the Command Prompt window by right-clicking on the title bar.

Take a look at Can't enter password in Windows · Issue #671 · pypa/twine · GitHub; there’s a screen capture that shows how the window menu works.

I don’t use Windows regularly, but back when I was trouble-shooting the above issue, I think I tried the new Windows Terminal, and didn’t experience this issue.

Is right-click to paste enabled by default on Windows Terminal?

Thank you, that is exactly what I was looking for! I have now enabled Ctrl+Shift+C/V and that works. Thanks for everyone’s help!