| AzureManualToken | R Documentation |
Initialize a manual token from a raw access token string.
Refresh the token. Manual tokens cannot be refreshed.
Check if this token can be refreshed.
Cache the token. Manual tokens are not cached.
Compute a hash for this token.
Print the token object.
token |
A character string containing the access token. |
type |
The token type, usually "Bearer". |
tenant |
Optional tenant ID. If NULL, extracted from JWT claims. |
resource |
Optional resource/audience. If NULL, extracted from JWT claims. |
An R6 object of class AzureManualToken, inheriting from AzureToken.
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.
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.
Returns self invisibly.
Always returns FALSE for manual tokens.
Returns NULL invisibly.
An MD5 hash string based on the token content.
new(token, type, tenant, resource): Initialize a new manual token object.
refresh(): Cannot refresh a manual token; issues a warning and returns self.
validate(): Checks if the token has expired based on JWT claims.
can_refresh(): Returns FALSE since manual tokens cannot be refreshed.
cache(): No-op; manual tokens are not cached.
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.