Authentication mechanism for protected earthdata https links
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- python
- Domain
- api, authentication
Research direction
Start with the HTTPStore and its client_options default_headers example in the issue, then determine whether the requested NASA Earthdata token handling belongs in a credential provider or documentation. Done means a documented or implemented way to access the protected Earthdata HTTPS URL with its Bearer token.
Written by the indexing model from the issue text.
Description
I am not sure if this deserves any special treatment in obstore, but I'll file the issue anyways 😄
NASA makes all of its archived data publicly available via HTTPS links that require an EDL token to access. Here is a basic example of how to do this with obstore:
import os
import requests
from obstore.store import HTTPStore
def get_earthdata_token(username: str, password: str) -> str:
r = requests.post(
"https://urs.earthdata.nasa.gov/api/users/find_or_create_token",
auth=(username, password),
)
r.raise_for_status()
return r.json()["access_token"]
token = get_earthdata_token(
os.getenv("EARTHDATA_USERNAME"),
os.getenv("EARTHDATA_PASSWORD"),
)
url = "https://data.lpdaac.earthdatacloud.nasa.gov/lp-prod-protected"
store = HTTPStore(
url,
client_options={
"default_headers": {
"Authorization": f"Bearer {token}",
}
},
)
store.head("ECO_L2T_STARS.002/ECOv002_L2T_STARS_20FPJ_20180709_0712_01/ECOv002_L2T_STARS_20FPJ_20180709_0712_01_NDVI.tif")
{'path': 'ECO_L2T_STARS.002/ECOv002_L2T_STARS_20FPJ_20180709_0712_01/ECOv002_L2T_STARS_20FPJ_20180709_0712_01_NDVI.tif',
'last_modified': datetime.datetime(2025, 2, 19, 7, 57, 25, tzinfo=datetime.timezone.utc),
'size': 217222,
'e_tag': '"3bb863cba40abe7bb8184e5033c32ca9-1"',
'version': None}
This is not too much work but I wonder if it would be useful to create a NasaEarthdataHTTPCredentialProvider that could handle all of the token logic for the user provide the Auth: Bearer xxxx header to the HTTPStore when making requests. These tokens are really long-lived (60 days?) so token refreshes are not a concern.
Maybe this is not worth any code changes and a docs example would suffice!
- Dominant language
- Python
- Stars
- 842
- Forks
- 50
- Avg merge
- 9h
- Merged PRs (30d)
- 13
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from developmentseed/obstore
-
fsspec: `get_file` silently writes nothing for `file://` and Windows pathsPossibly taken @andyhetianjun claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
developmentseed/obstore#830 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
developmentseed/obstore#823 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
developmentseed/obstore#819 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 18/100
developmentseed/obstore#816 · 3 comments ·
Maintainers usually reply within 1 day
-
`put_async(Path)` opens files synchronously while holding the GILPossibly taken @kylebarron claimed this 14 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
developmentseed/obstore#809 · 1 comment ·
Maintainers usually reply within 1 day
All issues in developmentseed/obstore
Similar issues
-
00 - Bug component: numpy.linalg
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
521xueweihan/HelloGitHub#4543 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
emeryberger/CSrankings#15700 ·
Maintainers usually reply within 2 days
-
Bug | 工作不正常 Triage | 待检查
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
OneDragon-Anything/ZenlessZoneZero-OneDragon#3084 ·
Maintainers usually reply within 1 day
-
Task select patterns with uppercase letters never matchPossibly taken @manobhisriram claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day