Skip to content

Commit 4f7cf52

Browse files
authored
[SYNPY-1296] Config client error with api key or PAT (#990)
* Update to check for blank username
1 parent f2a4a40 commit 4f7cf52

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

synapseclient/__main__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,18 +1792,23 @@ def _authenticate_login(syn, user, secret, **login_kwargs):
17921792

17931793
login_attempts = (
17941794
# a username is required when attempting a password login
1795-
("password", lambda user, secret: user is not None and secret is not None),
1795+
(
1796+
"password",
1797+
lambda user, secret: user is not None and user != "" and secret is not None,
1798+
),
17961799
# auth token login can be attempted without a username.
17971800
# although tokens are technically encoded, the client treats them as opaque so we don't do an encoding check
17981801
# on the secret itself
17991802
("authToken", lambda user, secret: secret is not None),
18001803
# username is required for an api key and secret is base 64 encoded
18011804
(
18021805
"apiKey",
1803-
lambda user, secret: user is not None and utils.is_base64_encoded(secret),
1806+
lambda user, secret: user is not None
1807+
and user != ""
1808+
and utils.is_base64_encoded(secret),
18041809
),
18051810
# an inputless login (i.e. derived from config or cache)
1806-
(None, lambda user, secret: user is None and secret is None),
1811+
(None, lambda user, secret: (user is None or user == "") and secret is None),
18071812
)
18081813

18091814
first_auth_ex = None

0 commit comments

Comments
 (0)