Rust 1.74 and credential-process
Changes
In Rust 1.74, the registry-auth
feature was stabilized, which provided full support in Cargo for authenticated requests, including downloads, to private regsitries.
This version also introduced new configuration for "credential providers", which specifies how Cargo authenticates those requests.
As of 1.74, Cargo requires the [registry.global-credential-providers]
key to be configured in ~/.cargo/config.toml
to be able to perform authenticated requests.
Example config:
# ~/.cargo/config.toml
[registry]
global-credential-providers = ["cargo:token"]
Without configuring global-credential-providers
, you may get an error like this when Cargo tries to download a .crate
file from the registry server:
$ cargo +nightly check
error: failed to download `my-private-crate v1.2.3 (registry `shipyard-rs`)`
Caused by:
unable to get packages from source
Caused by:
authenticated registries require a credential-provider to be configured
see https://doc.rust-lang.org/cargo/reference/registry-authentication.html for details
The current official documentation has recommended also including cargo:libsecret
in global-credential-providers
on Linux. Including it may result in the following error message:
$ cargo +nightly check
error: failed to download `my-private-crate v1.2.3 (registry `shipyard-rs`)`
Caused by:
unable to get packages from source
Caused by:
credential provider `cargo:libsecret` failed action `get`
Caused by:
failed to load libsecret: try installing the `libsecret` or `libsecret-1-0` package with the system package manager
Caused by:
libsecret-1.so: cannot open shared object file: No such file or directory
To resolve this error, either remove cargo:libsecret
from the list of credentials providers, or install libsecret using your package manager. cargo:token
will allow you to use token-based authentication, which is used by Shipyard.rs.