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

Improve credential errors for github-likes #235

Merged
merged 1 commit into from
Feb 13, 2023
Merged

Improve credential errors for github-likes #235

merged 1 commit into from
Feb 13, 2023

Conversation

mih
Copy link
Member

@mih mih commented Feb 13, 2023

Previously, when a credential was auto-discovered or entered -- but then access failed -- identical errors meesages were produced:

Credential did not yield successful authorization

without any advice on what to do.

With this change, the error message is different, depending on whether a credential was automatically determined from a query, or whether it was entered manually right before the access attempt. Now it would say:

Auto-selected existing credential:

Auto-selected did not yield successful authorization.
Please select a different credential via the credential option of
this command, or remove/edit the credential with the DataLad command
credentials.

Entered credential:

Entered did not yield successful authorization.
Please try again with a valid credential.

In both cases the underlying reason for the unsuccessful attempt (generally a 401 response code) continues to be reported.

Now a user can be better aware how credential selection can be performed, and that there is a credential management command.

The idea of an interactive enter-try-fail-reenter loop to guide a user has been rejected, because of the implied complexity from possible mitigation strategies. Importantly, the fact that an existing credential does not work for a particular operation is insufficient for concluding that a credential is completely invalid (hence could be replaced). It may simply be insufficient for the target operation, but remains useful or needed for others.

Previously, when a credential was auto-discovered or entered -- but then
access failed -- identical errors meesages were produced:

> Credential <credential name> did not yield successful authorization

without any advice on what to do.

With this change, the error message is different, depending on whether
a credential was automatically determined from a query, or whether it
was entered manually right before the access attempt. Now it would say:

Auto-selected existing credential:

> Auto-selected <credential name> did not yield successful authorization.
  Please select a different credential via the `credential` option of
  this command, or remove/edit the credential with the DataLad command
  `credentials`.

Entered credential:

> Entered <credential name> did not yield successful authorization.
  Please try again with a valid credential.

In both cases the underlying reason for the unsuccessful attempt
(generally a 401 response code) continues to be reported.

Now a user can be better aware how credential selection can be
performed, and that there is a credential management command.

The idea of an interactive enter-try-fail-reenter loop to guide a user
has been rejected, because of the implied complexity from possible
mitigation strategies. Importantly, the fact that an existing credential
does not work for a particular operation is insufficient for concluding
that a credential is completely invalid (hence could be replaced).
It may simply be insufficient for the target operation, but remains
useful or needed for others.
@mih mih merged commit 380e659 into datalad:main Feb 13, 2023
@mih mih deleted the credux branch February 17, 2023 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant