Skip to contents

Validates the REDCap API token stored in the `DB` object by attempting a connection to the REDCap server.

Usage

test_REDCap_token(DB, set_if_fails = T, launch_browser = T)

Arguments

DB

A validated `DB` object containing REDCap project data and settings. Generated using load_DB or setup_DB

set_if_fails

Logical (TRUE/FALSE). If TRUE and test connection fails, asks user to paster token into consult using `set_REDCap_token(DB)` function. Default is `TRUE`.

launch_browser

Logical (TRUE/FALSE). If TRUE, launches the REDCap login page in the default web browser when validation fails. Default is `TRUE`.

Value

Logical. Returns `TRUE` if the API token is valid, otherwise `FALSE`.

Details

This function tests whether the API token stored in the `DB` object is valid by making a request to the REDCap server. If the token is invalid, the function can optionally open the REDCap login page in a browser (`launch_browser`) and/or reset the token (`set_if_fails`) using the console.