calpass_get_token {calpassapi}R Documentation

Obtain CalPASS API token

Description

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

Usage

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

## 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)

[Package calpassapi version 0.0.3 Index]