-
Notifications
You must be signed in to change notification settings - Fork 98
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
[BUG] earthaccess.login tries other strategies when it should not #945
Comments
There's the problem: earthaccess/earthaccess/__init__.py Line 89 in 3f8b03a
This is pretty magical! There are two places we are trying multiple strategies: one in |
Perhaps the "all strategy" logic should be moved into the |
Yep, we should not be doing that. |
Yeah, to me it makes the most sense for this to all be encapsulated in the |
I was just going to report this bug. Calling It looks like a call to which pops into the module-level This function then calls After those both fail, the original call to I'm not sure what the origin of the module-level Debugger session to show the three authn attempts:
|
👋 Hi, Kevin, good to see you! Want work on this with us at a hackathon sometime soon? 😁 I think we need a test that when the user specifies a specific strategy, earthaccess only uses that strategy. |
I would like to, I'll see what I can do. Do you have an idea for what the fix would look like? |
I think I need to do some debugging to feel more comfortable about the solution. What I know is that we have two places where we're programmatically trying multiple strategies: One in the
@chuckwondo @betolink @asteiker @jhkennedy @itcarroll what do you think of this behavior contract? 👆 We should be super explicit in the docstring. |
Is this issue already tracked somewhere, or is this a new report?
Current Behavior
When calling
earthaccess.login
with a strategy other than"all"
, it might call one or more other strategies.Expected Behavior
When calling
earthaccess.login
with a strategy other than"all"
, it should attempt only the specified strategy.Steps To Reproduce
The following should ignore the env vars as well as netrc, and only prompt for creds, but does not.
It uses the env vars to login, even though the strategy is
"interactive"
, not"all"
(of course, replaceusername
andpassword
with valid Earthdata Login creds):If the creds are valid, you are not prompted for creds, as the env vars are used to successfully login, and thus the "interactive" strategy is skipped.
Conversely, if you use invalid creds for the env vars, login will still attempt to use them, but since login will fail with them, the "netrc" strategy will be tried. If you have a valid netrc entry, login will succeed without prompting you for creds.
Only when neither valid env vars nor a valid netrc entry exists will you will be prompted to enter creds. However, neither of the other strategies should be attempted at all, not even if a user enters invalid creds interactively.
Environment
Additional Context
No response
The text was updated successfully, but these errors were encountered: