| AzureManualToken | R Documentation |
Create an Azure token object from a pre-existing access token string. This is useful
when you have obtained a token externally (e.g., via Azure CLI, Python, or another
authentication mechanism) and want to use it with the AzureR ecosystem. Rather than
calling the new() method directly, tokens should be created via get_manual_token().
An R6 object of class AzureManualToken, inheriting from AzureToken.
The AzureManualToken class provides a way to wrap an externally-obtained access
token string so it can be used with packages like AzureGraph, AzureRMR,
and other AzureR family packages that expect an AzureToken object.
If the token is a JWT (JSON Web Token), the class will attempt to parse it to extract metadata such as the tenant ID, audience (resource), and expiration time. If parsing fails (e.g., for opaque tokens), the class will still function but with limited metadata.
Since manual tokens are managed externally, the refresh() method cannot obtain
a new token. When the token expires, you must create a new AzureManualToken
object with a fresh token string.
This section documents how the methods for manual tokens differ from other token objects.
refresh: Manual tokens cannot be refreshed; you must create a new token object.
can_refresh: Always returns FALSE for manual tokens.
cache: Manual tokens are not cached; this method does nothing.
hash: The hash is based on the token string itself, rather than the R-level metadata.
get_manual_token, AzureToken, decode_jwt
## Not run:
# Get a token externally (e.g., from Azure CLI)
# az account get-access-token --resource https://graph.microsoft.com
raw_token <- "eyJ0eXAiOiJKV1QiLC..."
# Create a manual token object
token <- get_manual_token(raw_token)
# Check if metadata was parsed
print(token$tenant)
print(token$resource)
# Use with AzureGraph
library(AzureGraph)
gr <- ms_graph$new(token = token)
me <- gr$get_user("me")
# Check token validity
token$validate()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.