From 411a6753c504de2634cefb23d72af71c205cc8e4 Mon Sep 17 00:00:00 2001 From: Fran Barton Date: Mon, 12 Jan 2026 14:40:25 +0000 Subject: [PATCH 1/2] Allow passing of token into read_azure_table() Should close #76 --- DESCRIPTION | 2 +- R/read_azure_table.R | 11 +++++++++-- man/read_azure_table.Rd | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 039256e..5e10cfd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: azkit Title: Azure storage authentication toolkit -Version: 0.2.0 +Version: 0.2.2 Authors@R: person( "Fran", "Barton", diff --git a/R/read_azure_table.R b/R/read_azure_table.R index 0782dcb..e17515a 100644 --- a/R/read_azure_table.R +++ b/R/read_azure_table.R @@ -7,12 +7,19 @@ #' the default, the function will look instead for a value stored in the #' environment variable "AZ_TABLE_EP" #' @param ... parameters to be passed through to [get_auth_token] +#' @inheritParams get_container #' @returns A tibble #' @export -read_azure_table <- function(table_name = NULL, table_endpoint = NULL, ...) { +read_azure_table <- function( + table_name = NULL, + table_endpoint = NULL, + token = NULL, + ... +) { table_name <- table_name %||% check_envvar("AZ_TABLE_NAME") table_ep <- table_endpoint %||% check_envvar("AZ_TABLE_EP") - access_token <- get_auth_token(...) |> + token <- token %||% get_auth_token(...) + access_token <- token_refresh(token) |> purrr::pluck("credentials", "access_token") headers <- list("2025-11-05", "application/json;odata=nometadata") |> purrr::set_names(c("x-ms-version", "Accept")) diff --git a/man/read_azure_table.Rd b/man/read_azure_table.Rd index 07c877b..0dc2010 100644 --- a/man/read_azure_table.Rd +++ b/man/read_azure_table.Rd @@ -4,7 +4,7 @@ \alias{read_azure_table} \title{Read in data from an Azure table} \usage{ -read_azure_table(table_name = NULL, table_endpoint = NULL, ...) +read_azure_table(table_name = NULL, table_endpoint = NULL, token = NULL, ...) } \arguments{ \item{table_name}{name of the table to be read. If left as \code{NULL}, @@ -15,6 +15,9 @@ environment variable "AZ_TABLE_NAME"} the default, the function will look instead for a value stored in the environment variable "AZ_TABLE_EP"} +\item{token}{An Azure authentication token. If left as \code{NULL}, a token +returned by \link{get_auth_token} will be used} + \item{...}{parameters to be passed through to \link{get_auth_token}} } \value{ From f0f41e9b15f4e8ac1c7d7a006b3377277938b9c2 Mon Sep 17 00:00:00 2001 From: Fran Barton Date: Mon, 12 Jan 2026 22:06:58 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9D=8E=20Don't=20bake=20in=20refresh=5Ft?= =?UTF-8?q?oken()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/read_azure_table.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/read_azure_table.R b/R/read_azure_table.R index e17515a..b4b92f0 100644 --- a/R/read_azure_table.R +++ b/R/read_azure_table.R @@ -19,7 +19,7 @@ read_azure_table <- function( table_name <- table_name %||% check_envvar("AZ_TABLE_NAME") table_ep <- table_endpoint %||% check_envvar("AZ_TABLE_EP") token <- token %||% get_auth_token(...) - access_token <- token_refresh(token) |> + access_token <- token |> purrr::pluck("credentials", "access_token") headers <- list("2025-11-05", "application/json;odata=nometadata") |> purrr::set_names(c("x-ms-version", "Accept")) @@ -37,3 +37,4 @@ read_azure_table <- function( purrr::map(tibble::as_tibble) |> purrr::list_rbind() } +