calpass_get_token: Obtain CalPASS API token

Description Usage Arguments Value Author(s) Examples

View source: R/calpassapi.R

Description

Obtain a token from CalPASS using your API credentials, which should allow access for 60 minutes.

Usage

1
2
3
4
5
6
7
8
calpass_get_token(
  username = Sys.getenv("cp_api_uid"),
  password = Sys.getenv("cp_api_pwd"),
  client_id,
  scope,
  auth_endpoint = "https://oauth.calpassplus.org/connect/token",
  verbose = FALSE
)

Arguments

username

API username. For security reasons, the user could specify cp_api_uid in the user's .Renviron file in the user's home directory (execute Sys.getenv('HOME') in R to check path to home directory). That way, the user does not have to hard code the username in their R script. The function uses for the username here by default.

password

API password. The user could specify cp_api_pwd as above.

client_id

parameter needed in the http body in order to obtain a token (unique to username)

scope

parameter needed in the http body in order to obtain a token (unique to username)

auth_endpoint

Authentication endpoint/url, defaults to 'https://oauth.calpassplus.org/connect/token'.

verbose

If TRUE, then print http exchanges (to assist with debugging). Defaults to FALSE.

Value

CalPASS token string

Author(s)

Vinh Nguyen

Examples

1
2
3
4
5
6
7
## Not run: 
cp_token <- calpass_get_token(username='my_cp_api_uid', password='my_cp_api_pwd'
  , client_id='my_client_id'
  , scope='my_scope'
  )

## End(Not run)

vinhdizzo/calpassapi documentation built on Aug. 7, 2020, 4:13 a.m.