Skip to contents

The `rd_VerifyToken` function checks whether a given JWT (JSON Web Token) is still valid by inspecting its expiration time (`exp` claim). It decodes the token's payload without verifying its signature.

Usage

rd_VerifyToken(token = refinitiv_vault_get("access_token"), warn = TRUE)

Arguments

token

A character string representing the JWT access token. Defaults to the current vaulted access token (`refinitiv_vault_get("access_token")`).

warn

Logical. If `TRUE` (default), issues a warning when the token is expired or within the safety buffer. Set to `FALSE` during routine refresh checks.

Value

A logical value:

`TRUE`

if the token is valid (i.e., not expired).

`FALSE`

if the token is expired or invalid.

Examples

if (FALSE) { # \dontrun{
# Example token (replace with a real token)
access_token <- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
is_valid <- rd_VerifyToken(access_token)
print(is_valid)
} # }