Skip to content

Commit

Permalink
add back in the auth login url for ASF
Browse files Browse the repository at this point in the history
This is the URL that you get redirected to due to a 302 response.

You can see the flow with

$ curl -v -L "https://s1qc.asf.alaska.edu/aux_poeorb/S1A_OPER_AUX_POEORB_OPOD_20231102T080652_V20231012T225942_20231014T005942.EOF"

it was added previously, but was failing in my testing during the big
switchover.

It is possible we don't need this at all if that have an earthdata
token, but i could not get that to work either. Will check with ASF
people about that.
  • Loading branch information
scottstanie committed Nov 6, 2023
1 parent 9083282 commit efcf14c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion eof/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,12 @@ def _download_and_write(url, save_dir=".", asf_user="", asf_password=""):
return [fname]

logger.info("Downloading %s", url)
login_url = (
"https://urs.earthdata.nasa.gov/oauth/authorize?response_type=code"
f"&client_id=BO_n7nTIlMljdvU6kRRB3g&redirect_uri=https://auth.asf.alaska.edu/login&state={url}"
)
# Add credentials
response = requests.get(url, auth=(asf_user, asf_password))
response = requests.get(login_url, auth=(asf_user, asf_password))
response.raise_for_status()
logger.info("Saving to %s", fname)
with open(fname, "wb") as f:
Expand Down

0 comments on commit efcf14c

Please sign in to comment.