wiki:udg/ecoms/RPackage/authentication

Version 4 (modified by gutierjm, 8 years ago) (diff)

--

The SPECS-EUPORIAS Data Portal is based on a password-protected THREDDS data server providing metadata and data access to a set of geo-referenced atmospheric variables using OPeNDAP and other remote data access protocols. Therefore, before accessing the data, authentication is required at the SPECS-EUPORIAS Data Portal.

Within a R session, this step can be easily accomplished assuming that we already have a valid username and password. To this aim, in the following lines we illustrate how to proceed using the R-to-Java interface provided by the package rJava (For more information on the authentication procedure click on the help page).

> username <- "myUsername" # This is a character string with the username
> password <- "myPassword" # This is a character string with the password
> aux <- .jnew("ucar/nc2/util/net/HTTPBasicProvider", username, password)
> J("ucar.nc2.util.net.HTTPSession")$setGlobalCredentialsProvider(aux)