Description Usage Arguments Details Value Examples
Standalone OAuth authorization functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | build_authorization_uri(
resource,
tenant,
app,
username = NULL,
...,
aad_host = "https://login.microsoftonline.com/",
version = 1
)
get_device_creds(
resource,
tenant,
app,
aad_host = "https://login.microsoftonline.com/",
version = 1
)
|
resource, tenant, app, aad_host, version |
See the corresponding arguments for get_azure_token. |
username |
For |
... |
Named arguments that will be added to the authorization URI as query parameters. |
These functions are mainly for use in embedded scenarios, such as within a Shiny web app. In this case, the interactive authentication flows (authorization code and device code) need to be split up so that the authorization step is handled separately from the token acquisition step. You should not need to use these functions inside a regular R session, or when executing an R batch script.
For build_authorization_uri
, the authorization URI as a string. This can be set as a redirect from within a Shiny app's UI component.
For get_device_creds
, a list containing the following components:
user_code
: A short string to be shown to the user
device_code
: A long string to verify the session with the AAD server
verification_uri
: The URI the user should browse to in order to login
expires_in
: The duration in seconds for which the user and device codes are valid
interval
: The interval between polling requests to the AAD token endpoint
message
: A string with login instructions for the user
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | build_authorization_uri("https://myresource", "mytenant", "app_id",
redirect_uri="http://localhost:8100")
## Not run:
## obtaining an authorization code separately to acquiring the token
# first, get the authorization URI
auth_uri <- build_authorization_uri("https://management.azure.com/", "mytenant", "app_id")
# browsing to the URI will log you in and redirect to another URI containing the auth code
browseURL(auth_uri)
# use the code to acquire the token
get_azure_token("https://management.azure.com/", "mytenant", "app_id",
auth_code="code-from-redirect")
## obtaining device credentials separately to acquiring the token
# first, contact the authorization endpoint to get the user and device codes
creds <- get_device_creds("https://management.azure.com/", "mytenant", "app_id")
# print the login instructions
creds$message
# use the creds to acquire the token
get_azure_token("https://management.azure.com/", "mytenant", "app_id",
auth_type="device_code", device_creds=creds)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.