New Token - Access HLS

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
cbourque17
Posts: 6
Joined: Mon Jan 15, 2024 11:05 am America/New_York
Answers: 0

New Token - Access HLS

by cbourque17 » Tue Mar 19, 2024 2:43 pm America/New_York

I have been using a script to download HLS data from a Python script using my earth data credentials stored in a .netcr file. My first token expired today, giving me this error message when trying to do a search:
RuntimeError: {"errors":["Token [Bearer eyJXXXE6LLQ] has expired. Note the token value has been partially redacted."]}

I generated a new toke, but I still get the same error. Do I need to change something in my credential file? Or does it just take a day to apply the change?

Thanks!

Filters:

LP DAAC - dgolon
User Services
User Services
Posts: 333
Joined: Mon Sep 30, 2019 10:00 am America/New_York
Answers: 0
Has thanked: 24 times
Been thanked: 4 times
Contact:

Re: New Token - Access HLS

by LP DAAC - dgolon » Tue Mar 19, 2024 4:31 pm America/New_York

Hi @cbourque17 It should not take a day to generate. If you haven't tried already, I recommend using the earthaccess package for an easy authentication or re-authentication. After installing and importing this package, runearthaccess.login(persist=True) function. This function will prompt for your NASA Earthdata username and password to create one if one does not exist and then uses your account information for authentication purposes. Thanks -- Danielle
Subscribe to the LP DAAC listserv by sending a blank email to lpdaac-join@lists.nasa.gov.

Sign up for the Landsat listserv to receive the most up to date information about Landsat data: https://public.govdelivery.com/accounts/USDOIGS/subscriber/new#tab1.

j.graham
Posts: 2
Joined: Thu Apr 11, 2024 7:54 am America/New_York
Answers: 0

Re: New Token - Access HLS

by j.graham » Wed May 08, 2024 7:18 am America/New_York

Also got this error recently and deleted my expired token so I couldn't investigate it further. It would seem that when making a request using someone's auth(email/passsword). If a token exists it uses it without checking if it has expired or not. Thus leading to the above error. Has someone investigated this? My current workaround is to refresh the token every day to ensure it never expires which I'm not too keen on!

Kind regards,

Joe Graham.

LP DAAC - dgolon
User Services
User Services
Posts: 333
Joined: Mon Sep 30, 2019 10:00 am America/New_York
Answers: 0
Has thanked: 24 times
Been thanked: 4 times
Contact:

Re: New Token - Access HLS

by LP DAAC - dgolon » Wed May 08, 2024 5:05 pm America/New_York

@j.graham have you tried setting up a refresh using earthaccess?

auth = earthaccess.login()
auth.refresh_tokens()
Subscribe to the LP DAAC listserv by sending a blank email to lpdaac-join@lists.nasa.gov.

Sign up for the Landsat listserv to receive the most up to date information about Landsat data: https://public.govdelivery.com/accounts/USDOIGS/subscriber/new#tab1.

Post Reply