library("AzureOAuth")
library("httr")

This will work better with screeshots of how to set up a native app on the Azure side of things.

endpoint <- oauth_endpoint_azure(tenant_id = Sys.getenv("azure_tenant_id"))
print(oauth_endpoint_azure(tenant_id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"))
app <- oauth_app(
  appname = Sys.getenv("azure_native_application_name"),
  key = Sys.getenv("azure_native_application_id"),
  secret = NULL
)
print(
  oauth_app(
    appname = "not_needed_but_can_be_useful",
    key = "ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj",
    secret = NULL
  )  
)
token <- oauth2.0_token(
  endpoint = endpoint, 
  app = app,
  user_params = list(resource = "https://management.core.windows.net/"),
  use_oob = FALSE
)

Let's wrap this in some syntactic sugar:

oauth_token_azure(
  tenant_id = Sys.getenv("azure_tenant_id"),
  application_id = Sys.getenv("azure_native_application_id"),
  name = Sys.getenv("azure_native_application_name")
)
oauth_token_azure(
  tenant_id = Sys.getenv("azure_tenant_id"),
  application_id = Sys.getenv("azure_native_application_id"),
  name = Sys.getenv("azure_native_application_name")
)


ijlyttle/AzureOAuth documentation built on May 5, 2019, 11:09 p.m.