Page 1 of 1

401 Error when Passing Credentials Resolved

Posted: Mon Oct 24, 2022 1:07 pm America/New_York
by LP DAAC - jwilson
Users have been experiencing 401 errors when trying to pass Earthdata Login authentication credentials to access data via scripts. The LP DAAC is pleased to report that this issue has been resolved. Users that were experiencing this error are encouraged to try their script again. If you are still experiencing a 401 error when attempting to download the data, please send a list of data products along with the data access script being used to download the data to LP DAAC User Services at lpdaac@usgs.gov.

Thank you for your patience while this issue was under review. LP DAAC apologizes for the inconvenience.
https://lpdaac.usgs.gov/news/401-error-when-passing-credentials-resolved/

Re: 401 Error when Passing Credentials Resolved

Posted: Thu Dec 07, 2023 3:53 pm America/New_York
by gatterr
I had this problem, and was because I was not using the .netrc file to authenticate in the site ...

I need to create a .netrc file (is easy!) with my credentials and save in a specific place in my computer to stop to have this problem (I was using the module request to download the data)

I did this, and after that, I start to access the site without problem:

In my OS WINDOWS, I use the .netrc file without the underline (LIKE IN LINUX). And works without problem.

To create the archive I used notepad.

Inside the archive I put only the line:

machine <the_link_that_you_want> login <your_login> password <your_password>

like the example below:

machine www.gmail.com login maria password 123456

To save the file, I put in the name of the file : .netrc (otherwise, only the extension, without name at all) and in the type of file I mark: all files

I saved the archive in me personal directory (like C:/users/maria)

The directory must be the same directory that you have folders like: .vscode, .conda, .python ....

after that, the program start to authenticate in the site without problems.

Re: 401 Error when Passing Credentials Resolved

Posted: Fri Dec 08, 2023 4:20 pm America/New_York
by LP DAAC - jwilson
@gatterr Great advice! Thank you for the tip!
LP DAAC