Skip to content

Commit

Permalink
hotfix: ERS credentials moved to body of login request
Browse files Browse the repository at this point in the history
  • Loading branch information
16EAGLE committed Sep 23, 2019
1 parent 734ea3e commit 2525bf2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ importFrom(httr,GET)
importFrom(httr,POST)
importFrom(httr,authenticate)
importFrom(httr,content)
importFrom(httr,content_type)
importFrom(httr,http_error)
importFrom(httr,http_status)
importFrom(httr,message_for_status)
Expand Down Expand Up @@ -70,6 +71,7 @@ importFrom(sf,st_sfc)
importFrom(sf,st_transform)
importFrom(sp,SpatialPolygons)
importFrom(tools,md5sum)
importFrom(utils,URLencode)
importFrom(utils,head)
importFrom(utils,tail)
importFrom(utils,unzip)
Expand Down
8 changes: 6 additions & 2 deletions R/internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,13 @@ is.url <- function(url) grepl("www.|http:|https:", url)
#' @param username username
#' @param password password
#' @keywords internal
#' @importFrom httr POST content stop_for_status warn_for_status content_type
#' @importFrom utils URLencode
#' @noRd
.ERS_login <- function(username, password){
x <- POST(paste0(getOption("gSD.api")$ee, 'login?jsonRequest={"username":"', username, '","password":"', password, '","authType":"EROS","catalogId":"EE"}'))
.ERS_login <- function(username, password, n_retry = 3){
x <- POST(url = paste0(getOption("gSD.api")$ee, "login"),
body = URLencode(paste0('jsonRequest={"username":"', username, '","password":"', password, '","authType":"EROS","catalogId":"EE"}')),
content_type("application/x-www-form-urlencoded; charset=UTF-8"))
stop_for_status(x, "connect to server.")
warn_for_status(x)
v <- content(x)$data
Expand Down

0 comments on commit 2525bf2

Please sign in to comment.