Open blackheartweb opened 2 months ago
You need to change your redirect URI.
your browser will be going to localhost on your desktop machine, where there is nothing running.
You can to use the rserver-url command or rstudioapi::translateLocalUrl to generate a proxy address which will allow your browser to reach localhost on workbench.
if you are wedded to the authorisation code flow, note this will probably require a change to your Azure AD app, and the random nature of the proxy address will mean you need a wildcard in the redirect URI allow pattern.
Hello Mattmalcher, Thankyou for your response I ran the rstudioapi:: translateLocalUrl ("http://localhost:1410") I got output similar to this "p/77c02a62".
Below is the script I am running, I have appended the above output to redirect uri.
library(AzureAuth) redirect <-"https://workbench.com/s/33cea31def16dca/p/77c02a62" token <- AzureAuth::get_azure_token( "https://management.azure.com/", "mytenant", "app_id", use_cache = FALSE, auth_type = "authorization_code" authorize_args=list(redirect_uri=redirect) )
When I run this I get the following error
Error: Expecting a single value: [extent=0].
Also I tried replace redirect uri with http://localhost:1410/p/77c02a62
library(AzureAuth) redirect <- "http://localhost:1410/p/77c02a62/" token <- AzureAuth::get_azure_token( "https://management.azure.com/", "mytenant", "app_id", use_cache = FALSE, auth_type = "authorization_code" authorize_args=list(redirect_uri=redirect) )
I get a browser window opened with "AADSTS50011: The redirect URI 'https://localhost:1410' specified in the request does not match the redirect URIs configured for the application. Make sure the redirect URI sent in the request matches one added to your application in the Azure portal"
When I set an redirect uri in my azure application and run the above code , I am again getting localhost refused to connect error.
Any suggestions would be much appreciated.
I am using azure auth in posit workbench rstudio ide which hosted on RHEL8 Linux azure server. Every time device code , the authentication is happening but for Authorization-code, the authentication is not happening.
I get localhost not found for the port 1410. It works normally in Rstudio ide