Is this issue already tracked somewhere, or is this a new report?
Current Behavior
When EARTHDATA_USERNAME and EARTHDATA_PASSWORD are set, they are used to fetch a valid EDL token, but this should not happen when EARTHDATA_TOKEN is set. They are still used to fetch a token even when one is already specified via EARTHDATA_TOKEN.
Expected Behavior
When EARTHDATA_TOKEN is set, do not use EARTHDATA_USERNAME and EARTHDATA_PASSWORD to fetch an EDL token.
Steps To Reproduce
- Set EARTHDATA_TOKEN to a valid EDL token
- Set EARTHDATA_USERNAME to a random invalid username
- Set EARTHDATA_PASSWORD to a random invalid password
- Activate your earthaccess python environment
- Run
python -c 'import earthaccess; earthaccess.login()'
This should produce the following output, but should not:
Authentication with Earthdata Login failed with:
{"error":"invalid_credentials","error_description":"Invalid user credentials"}
This should not happen because the value of EARTHDATA_TOKEN is valid, but occurs because even though EARTHDATA_TOKEN is set, the invalid EARTHDATA_USERNAME and EARTHDATA_PASSWORD pair are still used to attempt to fetch an EDL token.
Environment
Additional Context
No response