-
Notifications
You must be signed in to change notification settings - Fork 53
Closed
Labels
bugIssues due to a code bugIssues due to a code bug
Description
In #257 there are various reports of failure to authenticate even with valid user/pass, that is also my experience. (I'm considering maintaining this package, but be aware it will involve quite a bit of change and the scope of that is unknown as yet).
EDIT: oh I had lost sight of the changes here, I will take that on board: #273
What did work for me, was the get the token and use httr2 auth bearer:
token <- "<long string of characters *without* Authorization: Bearer prefix>"
library(httr2)
## inserting changes to code that are at line 75 in MODIStsp_download.R
remote_filename <- "https://e4ftl01.cr.usgs.gov/MOLT/MOD13A2.061/2016.06.09/MOD13A2.A2016161.h18v04.061.2021353012725.hdf"
r <- request(paste0(remote_filename, ".xml"))
rp <- req_auth_bearer_token(r, gsub("Authorization: Bearer ", "", token))
req_perform(rp)
<httr2_response>
GET https://e4ftl01.cr.usgs.gov/MOLT/MOD13A2.061/2016.06.09/MOD13A2.A2016161.h18v04.061.2021353012725.hdf.xml
Status: 200 OK
Content-Type: application/xml
Body: In memory (18359 bytes)it will be a bit of work to apply this (and I'd like to figure out why user/pass isn't working, it certainly is for me for generic download with wget etc), so interested in any futher feedback.
The Authorization/Bearer mechanism of earthdata is well supported now and understood, so we should leverage {earthdatalogin} I think.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIssues due to a code bugIssues due to a code bug