Authenticated Downloads: Configuration requires authorization for all crate downloads, unlike how works.

This page contains instructions for configuring ~/.cargo/config.toml. For additional discussion about cargo authentication, see the Authentication secion.

Unstable Option: -Z registry-auth

If you are using nightly, the unstable registry-auth feature is available, which prompts cargo to pass an auth token via the "Authorization" header in HTTP download requests.

To enable:

# ~/.cargo/config.toml

registry-auth = true

Additional details: Authenticated Downloads Via -Z registry-auth.

Via User-Agent

Example of using cargo's "user-agent" setting to pass an auth token (see Temporary Fix) - would be written to $CARGO_HOME/config.toml or other configuration path:

# set a custom user-agent header value for cargo requests:

user-agent = "shipyard AxzHJS6gWK="

# this setting, while facially unrelated and not strictly required for performing
# authentication # via the "user-agent" header, seems to mitigate various problems
# that arise from using the "user-agent" # header in a ... non-traditional way

git-fetch-with-cli = true