From e539c8bbf2d8a7ee497e039e3f36d2485fc5e62d Mon Sep 17 00:00:00 2001 From: hong-revo Date: Fri, 9 Nov 2018 16:54:48 +1100 Subject: [PATCH] make get_azure_token not ARM-specific --- R/AzureToken.R | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/R/AzureToken.R b/R/AzureToken.R index 77dd899..182ccbc 100644 --- a/R/AzureToken.R +++ b/R/AzureToken.R @@ -116,7 +116,7 @@ private=list( #' @param app Your client/app ID which you registered in AAD. #' @param auth_type The authentication type, either `"client_credentials"` or `"device_code"`. #' @param password Your password. Required for `auth_type == "client_credentials"`, ignored for `auth_type == "device_code"`. -#' @param arm_host URL for your Azure Resource Manager host. For the public Azure cloud, this is `https://management.azure.com/`. +#' @param resource_host URL for your resource host. For Resource Manager in the public Azure cloud, this is `https://management.azure.com/`. #' #' @details #' This function does much the same thing as [httr::oauth2.0_token()], but with support for device authentication and with unnecessary options removed. Device authentication removes the need to save a password on your machine. Instead, the server provides you with a code, along with a URL. You then visit the URL in your browser and enter the code, which completes the authentication process. @@ -126,13 +126,14 @@ private=list( #' [OAuth authentication for Azure Active Directory](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code), #' [Device code flow on OAuth.com](https://www.oauth.com/oauth2-servers/device-flow/token-request/) #' @export -get_azure_token=function(aad_host, tenant, app, auth_type=c("client_credentials", "device_code"), password, arm_host) +get_azure_token=function(aad_host, tenant, app, auth_type=c("client_credentials", "device_code"), + password, resource_host) { auth_type <- match.arg(auth_type) base_url <- construct_path(aad_host, tenant) if(auth_type == "client_credentials") - auth_with_creds(base_url, app, password, arm_host) - else auth_with_device(base_url, app, arm_host) + auth_with_creds(base_url, app, password, resource_host) + else auth_with_device(base_url, app, resource_host) }