Migrating from legacy token to NASA EarthData token to download ATL03 from NSIDC

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
eheijkoop
Posts: 1
Joined: Thu Jun 01, 2023 6:24 pm America/New_York
Answers: 0

Migrating from legacy token to NASA EarthData token to download ATL03 from NSIDC

by eheijkoop » Thu Jun 01, 2023 6:43 pm America/New_York

Hi there,

I recently discovered that the legacy token that I had been using (and updating every 30 days) has become deprecated. I used that to download ICESat-2 ATL03 programmatically for a certain region and letting the NSIDC do the spatial and temporal subsetting to reduce download volume on my end. It appears that the NASA EarthData token (https://urs.earthdata.nasa.gov/documentation/for_users/user_token) is what I need now. I have two questions regarding this transition:
1. With my NASA EarthData username+password I can create a token through the API (with my base64 credentials), as described in the aforementioned manual. However, I cannot use the described GET method to get one that I have previously created (with my username:password combo). I just get "Invalid credentials" as a response (see attached file). How can I fix this? All I did was copy the command as described in the manual, with the username and password that I used to log in to EarthData (and from which I am posting my question).

2. Once I have that new token, how do I use it to download ICESat-2 ATL03 from the NSIDC, with their subsetting options. What I have been using is the following command: curl -O -J -k --dump-header response-header.txt "https://n5eil02u.ecs.nsidc.org/egi/request?&short_name=ATL03&version=005&token=<my_token>&email=false&bounding_box=3.182,50.696,6.092,53.482&bbox=3.182,50.696,6.092,53.482&coverage=/gt1l/heights/h_ph,/gt1l/heights/lon_ph,/gt1l/heights/lat_ph&page_num=1" (with the token from the legacy method, and a lot more parameters to download). However, when I paste the new token into this command, it does not work. It downloads a response-header.txt file with error code 500 and an error.xml file with "InternalServerError" and "Your request cannot be processed at this time". Does this mean that the issue is on the NSIDC end and that the method of just replacing tokens is correct, or is there more to it?
Attachments
curl_output.png
curl_output.png (22.24 KiB) Not viewed yet

Tags:

NSIDC - bookerl
User Services
User Services
Posts: 10
Joined: Wed Dec 04, 2019 9:50 am America/New_York
Answers: 0

Re: Migrating from legacy token to NASA EarthData token to download ATL03 from NSIDC

by NSIDC - bookerl » Wed Jun 07, 2023 10:59 am America/New_York

@eheijkoop ,

We're taking a look at your request for support with tokens and will get back to you soon with more information.

Lisa

NSIDC - mbeig
User Services
User Services
Posts: 13
Joined: Tue Dec 07, 2021 11:49 am America/New_York
Answers: 0

Re: Migrating from legacy token to NASA EarthData token to download ATL03 from NSIDC

by NSIDC - mbeig » Thu Jun 08, 2023 6:51 pm America/New_York

Dear Eduard,

Thank you for reaching out on the Earthdata Forum. Bearer tokens work a little bit differently than echo tokens did. This format should work for curl: curl -b ~/.urs_cookies -c ~/.urs_cookies -O -J -L -H "Authorization: Bearer <your token>" --dump-header response_header.txt "<PA call>". The PA (programmatic access) call will be your example url, but without the "token=<my_token>". You can just delete that key value pair from your api call and then provide your bearer token earlier in the "Authorization: Bearer <your token>" part of the command.

I'm going to do some testing with getting the bearer token programmatically using those instructions. I'll be in touch about that part of your question.

Kind regards,

Mikala

Post Reply