Empty reply from server error
a131485 opened this issue · 1 comments
Hello,
I'm attempting to use AzureAuth to authenticate in Shiny (no token required, I just want to see if the user is who they say they are and handle delivery of a shiny app upon successful authentication).
I'm running R 4.2.1, on Red Hat Enterprise Linux Server release 7.9 (Maipo). sessionInfo()
below.
I'm using your template for authenticating from shiny, and I encounter this error:
Error in curl::curl_fetch_memory(url, handle = handle) :
Empty reply from server
Now, I understand that this will be very difficult to reproduce, but I'm wondering if perhaps the maintainers or anyone else has seen this pop up before, and what potential results may be.
The tenant, client, and app ID's are all correct because I can independently verify they return under the Go and Python MSAL libraries in the same Red Hat environment. In addition, the AzureAuth R package succeeds in a local Windows environment with the same values.
If I perform this simple operation, I get the same error as above:
token = get_azure_token(
resource = resource,
tenant = tenant,
app = app,
username = Sys.getenv("USER"),
password = Sys.getenv("PASS"),
version = 2,
auth_type = "client_credentials"
)
Here is the trace:
11: curl::curl_fetch_memory(url, handle = handle)
10: request_fetch.write_memory(req$output, req$url, handle)
9: request_fetch(req$output, req$url, handle)
8: request_perform(req, hu$handle$handle)
7: httr::POST(uri, body = body, encode = "form")
6: private$initfunc(auth_info)
5: (function (resource, tenant, app, password = NULL, username = NULL,
certificate = NULL, aad_host = "https://login.microsoftonline.com/",
version = 1, authorize_args = list(), token_args = list(),
use_cache = NULL, auth_info = NULL)
{
if (is.null(private$initfunc))
stop("Do not call this constructor directly; use get_azure_token() instead")
self$version <- normalize_aad_version(version)
if (self$version == 1) {
if (length(resource) != 1)
stop("Resource for Azure Active Directory v1.0 token must be a single string",
call. = FALSE)
self$resource <- resource
}
else self$scope <- sapply(resource, verify_v2_scope, USE.NAMES = FALSE)
if (is.null(use_cache))
use_cache <- !in_shiny()
self$aad_host <- aad_host
self$tenant <- normalize_tenant(tenant)
self$token_args <- token_args
private$use_cache <- use_cache
if (is.na(use_cache))
return()
if (use_cache)
private$load_cached_credentials()
request_time <- Sys.time()
if (is.null(self$credentials)) {
res <- private$initfunc(auth_info)
self$credentials <- process_aad_response(res)
}
private$set_expiry_time(request_time)
if (private$use_cache)
self$cache()
})(resource = "openid", tenant = "CENSORED",
app = "CENSORED",
password = "CENSORED", username = "CENSORED",
certificate = NULL, aad_host = "https://login.microsoftonline.com/",
version = 2, token_args = list(), use_cache = NULL)
4: do.call(super$initialize, common_args)
3: initialize(...)
2: AzureTokenClientCreds$new(common_args)
1: get_azure_token(resource = resource, tenant = tenant, app = app,
username = "CENSORED", password = "CENSORED",
version = 2, auth_type = "client_credentials")
Thank you for your help.
SessionInfo
R version 4.2.1 (2022-06-23)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Oracle Linux Server 7.9
Matrix products: default
BLAS/LAPACK: /home/a131485/miniconda3/envs/mrr-model-demo/lib/libopenblasp-r0.3.21.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] AzureAuth_1.3.3
loaded via a namespace (and not attached):
[1] httr_1.4.4 compiler_4.2.1 R6_2.5.1 cli_3.4.1 tools_4.2.1
[6] curl_4.3.3 rappdirs_0.3.3 jsonlite_1.8.2 openssl_2.0.3 rlang_1.0.6
[11] renv_0.16.0 askpass_1.1
I've discovered that I need to manually set the proxy to use via httr::set_config
, like so:
httr::set_config(httr::use_proxy(Sys.getenv("https_proxy")))