Log in Opal(s). Different login strategies are possible: (1) by providing username/password, or (2) by providing username/password and a one-time password code (TOPT) when user has activated two-factor authentication, or (3) by providing a personal access token (PAT), or (4) by providing a key pair in PEM format.

opal.login(
  username = getOption("opal.username"),
  password = getOption("opal.password"),
  token = getOption("opal.token"),
  url = getOption("opal.url"),
  opts = getOption("opal.opts", list()),
  profile = getOption("opal.profile"),
  restore = NULL
)

Arguments

username

User name in opal(s). Can be provided by "opal.username" option.

password

User password in opal(s). Can be provided by "opal.password" option.

token

Personal access token (since opal 2.15). Only effective if the username or the password is NULL or empty. Can be provided by "opal.token" option.

url

Opal url or list of opal urls. Can be provided by "opal.url" option. Secure http (https) connection is required.

opts

Curl options as described by httr (call httr::httr_options() for details). Can be provided by "opal.opts" option.

profile

R server profile name. This will drive the R server in which a R session will be created. If no remote R session is needed (because Opal specific operations are done), this parameter does not need to be provided. Otherwise, if missing, the default R server profile will be applied ('default'). See also opal.profiles.

restore

Workspace ID to be restored (see also opal.logout)

Value

A opal object or a list of opal objects.

See also

Other connection functions: opal.logout(), opal.profiles()

Examples

if (FALSE) {
#### The below examples illustrate the different ways to login in opal ####

# explicite username/password login
o <- opal.login(username = 'administrator', password = 'password', 
                url = 'https://opal-demo.obiba.org')
opal.logout(o)

 # explicite personal access token login
o <- opal.login(token = 'HYG16LO0VaX4O0UardNbiqmr2ByBpRke', 
                url = 'https://opal-demo.obiba.org')
opal.logout(o)

# login using options and user credentials
options(opal.username = 'administrator',
 opal.password = 'password',
 opal.url = 'https://opal-demo.obiba.org')
o <- opal.login()
opal.logout(o)

# login using options and personal access token
options(opal.token = 'HYG16LO0VaX4O0UardNbiqmr2ByBpRke',
        opal.url = 'https://opal-demo.obiba.org')
o <- opal.login()
opal.logout(o)

# login using ssl key pair
options(opal.opts = list(
          sslcert = 'my-publickey.pem',
          sslkey = 'my-privatekey.pem'))
o <- opal.login(url = 'https://opal-demo.obiba.org')
opal.logout(o)

# login with a R server profile
o <- opal.login(username = 'administrator', password = 'password', 
                url = 'https://opal-demo.obiba.org', profile = 'default')
opal.logout(o)
}