sqp_login: Login to the SQP 3.0 API

Description Usage Arguments Details Value Examples

View source: R/sqp_login.R

Description

Login to the SQP 3.0 API directly from R. Make sure that your username/email and password are previously registered at http://sqp.upf.edu/accounts/login/?next=/loadui/

Usage

1
sqp_login(username = NULL, password = NULL)

Arguments

username

your username or email as a string

password

your password as a string

Details

Currently sqp_login offers three possible ways to log in. The first is by placing your username/email and password as environment variables with names SQP_USER and SQP_PW. The second is placing your username/email and password as variables in options() with the same names. And finally, the third, and most insecure, is by providing your username/email and password as arguments to sqp_login. We discourage users to use the third option because it might pose security threats if the code is shared. See the examples below for practical explanations.

Note that if the username/email or password is incorrect, the function will throw an error. Make sure you can log in at http://sqp.upf.edu/accounts/login/?next=/loadui/ first.

Value

an invisible TRUE. But it will raise an error if the account doesn't match any SQP accounts.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
## Not run: 

## Let's suppose your username is 'mary' and your password is 'secret'.
## Set your environmental variables with Sys.setenv()

Sys.setenv(SQP_USER = 'mary')
Sys.setenv(SQP_PW = 'secret')

## You can run the previous two lines and then delete them.
## While that R session is open, sqp_login will search for these two
## variables even if you delete the previous lines. For example..

sqp_login()

## will login successfully. Users interested in setting these values
## as permament environment variables are referred to
https://csgillespie.github.io/efficientR/r-startup.html#renviron

## Similarly, you can set the values as options

options(
 SQP_USER = 'mary',
 SQP_PW = 'secret'
 )

sqp_login()

## Finally, if you never plan to share your code (and even then I suggest the
## other options), you can always use the account as arguments to sqp_login.

sqp_login(username = 'mary', password = 'secret')


## End(Not run)

recsm-asqme/sqpr documentation built on May 28, 2020, 4:06 p.m.