Skip to content

[BUG] When EARTHDATA_TOKEN is set, and EARTHDATA_USERNAME and EARTHDATA_PASSWORD are also set, the latter should be ignored, but are not #1121

@chuckwondo

Description

@chuckwondo

Is this issue already tracked somewhere, or is this a new report?

  • I've reviewed existing issues and couldn't find a duplicate for this problem.

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

  1. Set EARTHDATA_TOKEN to a valid EDL token
  2. Set EARTHDATA_USERNAME to a random invalid username
  3. Set EARTHDATA_PASSWORD to a random invalid password
  4. Activate your earthaccess python environment
  5. 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

- OS: any
- Python: any

Additional Context

No response

Metadata

Metadata

Assignees

Labels

type: bugSomething isn't working

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions