Dear community members,
I make requests to a Plumber API which is hosted on Posit Connect using a Posit Connect API Key for authentication. The API returns that the value of Sys.getenv()["RSTUDIO_USER_IDENTITY"] is empty. I would expect to receive a value for RSTUDIO_USER_IDENTITY, because the API Key is linked to a specific user account.
Why is Sys.getenv()["RSTUDIO_USER_IDENTITY"] empty when connecting to a Plumber API hosted on Posit Connect using a Posit Connect API Key?
Does a workaround exist to find out which user account is linked to the API Key that is being used for the API request?
Example Plumber API:
library(plumber)
#* @get /exampleapi
information <- function(req, res, session) {
return(Sys.getenv()["RSTUDIO_USER_IDENTITY"][[1]])
}