oauth_token_azure: Generate OAuth2.0 token for Azure native app.

Description Usage Arguments Details Value Examples

View source: R/oauth-token.R

Description

This is a wrapper to httr::oauth2.0_token(), dedicated to Azure OAuth access.

Usage

1
2
3
oauth_token_azure(tenant_id, application_id, name = NULL,
  user_params = list(resource = "https://management.core.windows.net/"),
  use_oob = FALSE, ...)

Arguments

tenant_id

character, tenant id issued by Azure

application_id

character, application id issued by Azure

name

character, name of application (optional)

user_params

named list, see httr::oauth2.0_token()

use_oob

logical, see httr::oauth2.0_token()

...

other arguments passed to httr::oauth2.0_token()

Details

The tenant_id is used to build the endpoint using oauth_endpoint_azure(). The application_id and (optional) name are used to build the app using httr::oauth_app().

On the Azure side, can build the app from the Azure Portal:

  1. Go to Active Directory > App registrations > New application registration.

  2. For "Application type", choose "Native".

  3. For "Sign-on URL", enter http://localhost:1410.

  4. Compose this link using tenant_id and application_id, then send to your Azure Tenant adminstrator (maybe that's you) to activate the permissions: https://login.microsoftonline.com/{tenant_id}/adminconsent?client_id={application_id}&state=12345&redirect_uri=http://localhost/

For more information on "activating" your app, please see this Azure documentation.

Value

A Token2.0 reference class (RC) object, returned by httr::oauth2.0_token().

Examples

1
2
3
4
5
6
7
8
## Not run: 
  oauth_token_azure(
    tenant_id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
    application_id = "ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj",
    name = "test-app"
  )

## End(Not run)

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