tntp_cred: TNTP Credential Get/Set Command

View source: R/tntp_cred.R

tntp_credR Documentation

TNTP Credential Get/Set Command

Description

A wrapper around the keyring package for secure credential management.

tntp_cred() will attempt to get a credential, and if no credential is found it will prompt you to add it (and then return it).

tntp_cred_set() will set a credential. By default it will prompt before overwriting any current credentials.

tntp_cred_list() will list all current credentials by sorted by service and username.

Usage

tntp_cred(service, username = NULL, keyring = NULL, prompt = NULL)

tntp_cred_set(
  service = NULL,
  username = NULL,
  keyring = NULL,
  prompt = NULL,
  overwrite = NULL
)

tntp_cred_list(service = NULL, keyring = NULL)

Arguments

service

The identifier for the credential you are pulling or setting

username

OPTIONAL. Can be used to specify different usernames for the same service

keyring

OPTIONAL. Can be used to specify a specific keyring

prompt

OPTIONAL. What text should be displayed above the input box for the key while setting?

overwrite

OPTIONAL. By default, tntp_cred_set() will prompt if it finds a credential already saved. Set this to TRUE to overwrite without prompting or FALSE to throw an error if a current credential is found.

Value

  • tntp_cred() returns a stored (or newly created) credential

  • tntp_cred_set() returns nothing

  • tntp_cred_list() returns a 2-column data frame of services and usernames

Examples


# Using tntp_cred() with qualtRics
library(qualtRics)

# If no credential is set, this command will prompt for it first
qualtrics_token <- tntp_cred("QUALTRICS_TOKEN")
qualtrics_api_credentials(api_key = qualtrics_token,
                          base_url = 'tntp.co1.qualtrics.com')

# To overwrite your Qualtrics credential
tntp_cred("QUALTRICS_TOKEN", .set = TRUE)


tntp/tntpr documentation built on March 27, 2024, 6:26 p.m.