Skip to content

Conversation

arlosi
Copy link
Contributor

@arlosi arlosi commented Sep 6, 2023

When a registry token cannot be found, or a token is invalid, cargo displays an error recommending cargo login.

Starting in rust 1.67 with #10592, the message was amended to include the environment variable that could also be used to include the token.

error: no token found for `alternative`, please run `cargo login --registry alternative`
or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN

With -Z credential-process, if cargo:token is not in registry.global-credential-providers or registries.<NAME>.credential-provider the suggested environment variable will not work.

This PR resolves the issue by removing the suggested environment variable.

Alternatives:

  • Check the available credential providers and determine if cargo:token was/will be used, and only display the message then.
  • Make the *_INDEX, *_TOKEN environment variables have precedence over credential providers.

@rustbot
Copy link
Collaborator

rustbot commented Sep 6, 2023

r? @ehuss

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-registry-authentication Area: registry authentication and authorization (authn authz) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 6, 2023
@arlosi arlosi marked this pull request as ready for review September 7, 2023 18:40
@arlosi arlosi closed this Sep 7, 2023
@arlosi arlosi deleted the cred-no-env branch September 8, 2023 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-registry-authentication Area: registry authentication and authorization (authn authz) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants