sanitize_token: Validate and sanitize the user's REDCap token

View source: R/sanitize-token.R

sanitize_tokenR Documentation

Validate and sanitize the user's REDCap token

Description

Verifies the token is nonmissing and conforms to the legal pattern of a 32-character hexadecimal value. Each character must be an (a) digit 0-9, (b) uppercase letter A-F, or (c) lowercase letter a-f. #' Trailing line endings are removed.

Usage

sanitize_token(token)

Arguments

token

The REDCap token. Required.

Value

The token, without a terminal newline character.

Note

Contact your institution's REDCap administrator for more information about your project-specific token.

Author(s)

Hao Zhu, Benjamin Nutter, Will Beasley, Jordan Mark Barbone

Examples

secret_token_1 <- "12345678901234567890123456ABCDEF"
secret_token_2 <- "12345678901234567890123456ABCDEF\n"
secret_token_3 <- "12345678901234567890123456abcdef"
REDCapR::sanitize_token(secret_token_1)
REDCapR::sanitize_token(secret_token_2)
REDCapR::sanitize_token(secret_token_3)

REDCapR documentation built on Aug. 10, 2022, 5:06 p.m.