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

[SYNPY-1296] Config client error with api key or PAT #990

Merged
merged 3 commits into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions synapseclient/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1792,18 +1792,23 @@ def _authenticate_login(syn, user, secret, **login_kwargs):

login_attempts = (
# a username is required when attempting a password login
("password", lambda user, secret: user is not None and secret is not None),
(
"password",
lambda user, secret: user is not None and user != "" and secret is not None,
),
# auth token login can be attempted without a username.
# although tokens are technically encoded, the client treats them as opaque so we don't do an encoding check
# on the secret itself
("authToken", lambda user, secret: secret is not None),
# username is required for an api key and secret is base 64 encoded
(
"apiKey",
lambda user, secret: user is not None and utils.is_base64_encoded(secret),
lambda user, secret: user is not None
and user != ""
and utils.is_base64_encoded(secret),
),
# an inputless login (i.e. derived from config or cache)
(None, lambda user, secret: user is None and secret is None),
(None, lambda user, secret: (user is None or user == "") and secret is None),
)

first_auth_ex = None
Expand Down