Page 1 of 1

New Token - Access HLS

Posted: Tue Mar 19, 2024 2:43 pm America/New_York
by cbourque17
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!

Re: New Token - Access HLS

Posted: Tue Mar 19, 2024 4:31 pm America/New_York
by LP DAACx - dgolon
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

Re: New Token - Access HLS

Posted: Wed May 08, 2024 7:18 am America/New_York
by j.graham
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.

Re: New Token - Access HLS

Posted: Wed May 08, 2024 5:05 pm America/New_York
by LP DAACx - dgolon
@j.graham have you tried setting up a refresh using earthaccess?

auth = earthaccess.login()
auth.refresh_tokens()