Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove environment variable suggestion from AuthorizationError #12628

Closed
wants to merge 1 commit into from

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