When authenticating with the TDS the client receives a 403 response even when the authentication is successful.
We are still having trouble authenticating the restricted SimpleGroup dataset.:
https://thredds-test.unidata.ucar.edu/thredds/dodsC/dev/d4icomp/restricted/SimpleGroup.nc4.dds
-
With a browser (tried FireFox, Chrome, and Safari) - We receive a 403 response. After reloading the page I am able to inspect metadata / download data for both DAP2 and DAP4
-
With the cURL command line tool - We always get a 403 error after some redirects, despite having the right credentials (username/password in our ~/.netrc file). Subsequent requests, made using the cookies from the first, return the correct response and an http status of 200:
curl -n -c "~/.cookies" -b "~/.cookies" -L https://thredds-test.unidata.ucar.edu/thredds/dodsC/dev/d4icomp/restricted/SimpleGroup.nc4.dds
- via python’s requests library: We always get 403
This is an operating system agnostic issue.
Also, when I look at the verbose cURL output it would appear that the client is redirected to an authentication endpoint here:
http://thredds-test.unidata.ucar.edu:443/thredds/restrictedAccess/opendapTesterRole
But then never redirected back to the original request URL.
~via python’s requests library: We always get 403~
Python's request.session.get(url, allow_redirects=True) always resulted in 400 status code. I managed to come up with a temporary fix for this on pydap's end by manually handling the redirects and cookies. And so pydap can read DAP4 data from the TDS with authentication, but that solution is somewhat fragile.
I believe we have this working now on thredds-test. Can you try again?
It worked on my end! I can successfully read the metadata now:
tds_url = "dap4://thredds-test.unidata.ucar.edu/thredds/dap4/dev/d4icomp/restricted/daymet_v4_daily_na_tmax_2010.nc4"
pyds = open_url(tds_url, session=session)
pyds.tree()
>>>
.daymet_v4_daily_na_tmax_2010.nc4
├──yearday
├──time_bnds
├──lambert_conformal_conic
├──tmax
├──x
├──y
├──lat
├──lon
└──time