I am running a R script on rstudio ide of posit workbench which hosted on Azure VM RHEL 8 Linux server. I am trying to connect to azure application using Azureauth R package using Authorization-code method. When I run the script, I get local host refused to connect but the same Works for device-code method of the Azureauth R package.
The below is R code which I have tried to connect azure application.
R Script -
library(AzureAuth)
redirect <- "http://localhost:1410" token <- AzureAuth::get_azure_token( "My_Resource",
"My_Tenant_ID",
"My_App_ID",
use_cache = FALSE,
auth_type = "authorization_code", authorize_args=list(redirect_uri=redirect) )
Error - localhost refused to connect**
But same code works via device-code method of azureauth r package
auth_type = "device_code"
I tried to open the new popped browser URL which gives out localhost refused to connect error via a Linux terminal command curl pop_browser_url and this is authenticating without any error .
Code with device code method works -
library(AzureAuth) redirect <- "http://localhost:1410" token <- AzureAuth::get_azure_token( "My_Resource", "My_Tenant_ID", "My_App_ID", use_cache = FALSE, auth_type = "device_code", authorize_args=list(redirect_uri=redirect) )



