401 Error Code, Using R and GET()

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
rishi.kowalski
Posts: 5
Joined: Thu Jan 30, 2025 12:24 pm America/New_York
Answers: 0

401 Error Code, Using R and GET()

by rishi.kowalski » Thu Jan 30, 2025 12:33 pm America/New_York

Hello,

I am trying to access NLDAS data via GDS as ASCII text. I've generated a series or URLs to call within R's httr::GET() function (see example below). I've confirmed the urls return data in browser, and was able to authenticate via my browser to view the data, however when I try to automate accessing these data in R, I'm getting a Status 401, Access Denied error from the server. I've reauthorized my token in my account and am using the following code to access the data:

GET("https://hydro1.gesdisc.eosdis.nasa.gov/dods/NLDAS_FORA0125_H.2.0.ascii?wind_e[271739:276739][33][354]", authenticate(key_get("nldas-credential-user"), key_get("nldas-credential-pass"))

This process has worked for me in the past, so I'm wondering what I need to do to authenticate - do I need to incorporate my token to the call somehow?

Relevant Info:
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS 15.2
httr_1.4.7
curl_6.0.1
RNetCDF_2.9-2

Filters:

GES DISC - jimacker
User Services
User Services
Posts: 19
Joined: Wed Dec 04, 2024 4:05 pm America/New_York
Answers: 0
Been thanked: 1 time

Re: 401 Error Code, Using R and GET()

by GES DISC - jimacker » Mon Feb 10, 2025 4:34 pm America/New_York

Hello,

We provided an answer to a similar query which you said had been resolved; does that apply to this post as well? It was discovered in a review of Earthdata Forum posts that had not yet received a reply.

rishi.kowalski
Posts: 5
Joined: Thu Jan 30, 2025 12:24 pm America/New_York
Answers: 0

Re: 401 Error Code, Using R and GET()

by rishi.kowalski » Mon Feb 10, 2025 4:40 pm America/New_York

Hi,

I mistakenly posted to the forum twice, with more detail in the second post. Didn't figure out how to delete the original as I'm a new forum user, so feel free to delete if necessary! Thanks!

Post Reply