Cargo publish says must be logged in

I'm trying to publish a crate and have run into this problem:

besp2% cargo login <redacted>
**Login** already logged in

besp2% cargo publish
**Updating** index
**warning:** manifest has no documentation, homepage or repository.
See for more info.
**Packaging** vector_utils v0.1.0 (/mnt/home/jaffe/repos/rust-toolbox/vector_utils)
**Verifying** vector_utils v0.1.0 (/mnt/home/jaffe/repos/rust-toolbox/vector_utils)
**Compiling** superslice v1.0.0
**Compiling** vector_utils v0.1.0 (/mnt/home/jaffe/repos/rust-toolbox/target/package/vector_utils-0.1.0)
**Finished** dev [unoptimized + debuginfo] target(s) in 3.20s
**Uploading** vector_utils v0.1.0 (/mnt/home/jaffe/repos/rust-toolbox/vector_utils)
**error:** api errors (status 403 Forbidden): must be logged in to perform that action

What am I doing wrong?

Try logging out and logging in?

Good idea. I just tried:

  1. Delete the relevant line from .cargo/credentials.
  2. Repeat the steps attempted above.

The login works but I still get the same error message when I try to publish.

Have you verified your e-mail address with crates-io?


Finally figured it out. I was confused by the instructions on The instructions there

If you want to use package commands from the command line, you will need to login with cargo login (token) using one of the tokens listed below.

seem to suggest that the strings that follow are what you put after cargo login. They are not! What you put after cargo login is the string that is shown when you FIRST create a new token. That string subsequently disappears.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.